JS Concatenation
I'm working with a sample API in JavaScript. My code is the following:
Line 2,
let api = "https://dummyjson.com/products/${index}";
doesn't work correctly. From my understanding, this is a template literal which acts similarly to concatenation? When I replace this line with: let api = "https://dummyjson.com/products/" + index;
, it works correctly. Am I using the ${}
incorrectly?2 Replies