Backtick In JavaScript(Nodejs Route Example)

Azen Moktan
Apr 11, 2021

Backtick are also know as template literals, template strings, fancy strings. it was introduced in the es2015 specifications.it is denoted by ``.

Example :

Let Assume we need to combine constant and string in our Nodejs application.

our snippet is basic route in Nodejs application where api variable having value of any URL link for example

let api = “api/v1”;

Now what we are trying to do is we are trying to combine constant and string without using “+” operator. both code work but in JavaScript we have better way of doing this and that is by using Backtick.

Without using Backtick:

without using Backtick
Without Using Backtick

Using Backtick:

Using Backtick

Note : this is basic usage of using backtick in Nodejs but it can be used in any JavaScript .

--

--

Azen Moktan
0 Followers

A highly resourceful, innovative, and competent Software Engineer with extensive experience in the design , coding and problem solving .