Learn javascript - Objects 8 - The this keyword 10/15


#1

https://www.codecademy.com/courses/learn-javascript-objects/lessons/objects/exercises/this?action=lesson_resume&course_redirect=introduction-to-javascript

I’ve got an idea for a hint. How about telling us to use backticks instead of the single quotes that have been used in everything up to this point. I had everything right except for the backticks & I was staring at my screen for almost 45 minutes.
Single quote: '
Backtick: `
After some rumaging online, this looks like the only place that that’s required, in template literals.


10 The this Keyword 1 - please explain backticks
#2

If the environment supports template literals then go ahead and use backticks to denote all strings, and only resort to quotes when the situation dictates. Backticks are fully supported if template literals are.

const vis = [`red`,`orange`,`yellow`,`green`,`blue`,`indigo`,`violet`]

Bottom line, literally, backticks all the way. It will reduce escapements by many fold, not to mention elliminate the drudgery of string formulation in general.

As for the hint being less than substantial, prompting this topic, we cannot speak for CC from this side. We only support each other, and move along.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.