Could someone please explain how the initial way does not work. but the ones in the comments do?
This is a bit confusing.
Could someone please explain how the initial way does not work. but the ones in the comments do?
This is a bit confusing.
Hi there
Hopefully, I can clear up a few things.
First, in JavaScript, excessive whitespace is ignored. So whether you used spaces or a new line in the ternary operator, both will work.
Second, your string in the 2nd console.log()
is 'I dont love that!'
which is missing an apostrophe.
To avoid the single quote confusion, you can use double quotes like in the examples in the forum:
"I don't love that!"
Hope that helps!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.