Backtick In JavaScript(Nodejs Route Example)
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:
Using Backtick:
Note : this is basic usage of using backtick in Nodejs but it can be used in any JavaScript .