Reputation: 35
I'm looking for a way to build an url using variables in my component. I just want it to be dynamic.
Example: "https://www.youtube.com/results?search_query=skijumper.name"
So if my variable skijumper.name = "Ahonen"
= > this is what I want to achieve : https://www.youtube.com/results?search_query=Ahonen
Thanks in advance
Upvotes: 0
Views: 123
Reputation: 5202
Try this
var url = "https://www.youtube.com/results?search_query="+skijumper.name;
Edit
ECMAscript6 :
let url = `https://www.youtube.com/results?search_query=${skijumper.name}`
Upvotes: 0
Reputation: 3740
let name = "Ahonen";
let urlYoutube = `https://www.youtube.com/results?search_query=${name}`;
Upvotes: 2