Chapter 8 - The this Keyword I


I came across this while learning JavaScript

Hello, my name is ${name here} … i failed after several attempts trying to decipher what that symbol was!

it is not a single quotation mark by the way and i didn’t know one can code with. After several hours, i just found it on my keyboard. Just incase anyone is having the same issue, It is not a single quotation mark!

Happy coding!

8.15 - The This Keyword! (Yes ... another one!)

They are called backticks.

`Hello, my name is ${name here}`


What you encountered was a template string which is the ES6 method for interpolating data into a string for storage or output. The data may be any expression or variable, which in the above case would be,

Glad that you took the time to find the backtick, and also to discover that it is useful for inline formatting, such as your opening post, and also, when three are used before and after, for posting code blocks.

function Person(name, isMarried) { = name;
    this.isMarried = isMarried;
    this.getName = function () {
        return `Hello, my name is ${}.`;
    this.getStatus = function () {
        return `${} is${this.isMarried ? '' : ' not'} married.`;

const weegillis = new Person("Wee Gillis", true);
const peterpan = new Person("Peter Pan", false);

console.log(weegillis.getName());    //->  Hello, my name is Wee Gillis.
console.log(peterpan.getName());     //->  Hello, my name is Peter Pan.

console.log(weegillis.getStatus());  //->  Wee Gillis is married.
console.log(peterpan.getStatus());   //->  Peter Pan is not married.


Thanks, sounds cool.


Thanks, this is so cool an explanation and use!


When you say inline, what do you mean? inline to html or to what/where?


inline refers to in the flow of prose text.

Where you wrote, 'Hello, my name is ${name here} ', it is in the same line as the rest of the sentence, marked down with single backticks.

`Hello, ...`


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