console.log("My name is {myName}.` My favorite city is {myCity}.`);
hi my code as above but its not working. i use the back tick. pls help
console.log("My name is {myName}.` My favorite city is {myCity}.`);
hi my code as above but its not working. i use the back tick. pls help
Hello people,
same here. I don´t get it: it prints out just fine but still it doesn´t let me move ahead to the next page.
I wrote:
console.log(My Name is ${myName}. My favorite city is ${myCity}.
)
backticks are there and as I said it printed out the way it should but still says: X
thanks for help, I´m stuck for today…
oh and I copied the backticks in here but they don´t show in the paste. hm``````
Perhaps change Name
to name
?
thank you very much! made my day.
Thanks I forgot the backticks
let myName = “Kaden”;
let myCity = “Jacksonville”;
console.log(My name is ${myName}. My favorite city is ${myCity}.
);
i think there is some sort of bug in it, i actually just put the Code Academy solution, and it doesn’t work !
any tips on how to pass this step ?
the codeacademy code that doesn"t work : 7
let myName = ‘Natalia’;
let myCity = ‘Mexico City’;
console.log(My name is ${myName}. My favorite city is ${myCity}.
) ;
OMG you know what fixed this??? Rebooting my laptop. I thin it got stuck.
Sobre esse erro, é que você deve usar os back-sticks…
basta imprimir o resultado da seguinte maneira:
console.log(My name is ${myName}.My favorite city is ${myCity}
)
Is there a reason for the $ to be attached to the braces containing the assigned value of the variable? Or is that just how it is in JScript?
It is common to JS, only, as far as I know. Some languages use the $ sign to denote a variable. In template literals, they are the variable within the template.
console.log(`I want to eat a ${fruit}.`)
// --------
// \
// variable placeholder
Whatever value fruit
refers to will be cast to its string representation and inserted in the text in place of the variable interpolation placeholder.
We should note that not just variables can be written into the placeholder. Whole expressions may be written there since all expressions yield a value.
I don’t know why it is not working, it just keeps showing on on this error at the bottom of the code,(Did you interpolate myName
and myCity
using back ticks and ${}
?)
It prints the output just fine, but still doesn’t let me move onto the next exercise
Got the answer. I was printing in different lines instead of same single line.
i believe the you did not make use of the backsticks `` and you probably made use of ‘’ instead hence, the error
i ran the same exact code and did not get any error. did you at any point modify this or this has been the exact code?
hello
I think from the code you have written, you are required to make use of two important things inline with the requirements
Hello,
I noticed one thing that is , if we are using a string interpolate using template literal, we need not to concatenate the two strings.
Here are few unnoticeable difference to fix it :
console.log(`My name is ${myName}. My favorite city is ${myCity}.`);
here is what it looked before the changes :
console.log(‘My name is {myName}. My favorite city is {myCity}.’);
Try using one on the left of 1 on your keyboard which is just above tab instead of the one next to ; and also the variable is missing $ before {}.
The instruction should really show ’ ’ and
side by side to make sure there is no confusion.
This message really helped me get a step further in my JS learning. I was stuck here for a few hours.