MY #100 DAYS OF CODE CHALLENGE JOURNEY-DAY 11

in #coding6 years ago

IMG_20190209_130735.jpg

We are still on my 100days of code challenge journey. As my learning of JavaScript ES6 continues, I learned the amazing functions of a template literal.

Template literal is an alternative for outputting without using single or double quotes. It uses a backtick and makes printing on screen easily manipulated.

Example

`go to
school`

\\prints go to
\\prints school

If we were to write the above output using single or double quotes we will require a newline character \n to print "school" on a new line.

Template literal also makes it possible to use a placeholder(${name}), a dollar sign followed by two curly brackets inside a string without the need to concatenate.

Example

var name = "Wright";

``my firstname is ${name}`

// Prints my firstname is Wright