Created
July 10, 2020 11:25
-
-
Save rishisidhu/16db3a2df8f69dc85c9fd3ee060983bd to your computer and use it in GitHub Desktop.
Modern JS ES6+ features - Template Literals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Currency1 = "Dollars"; | |
const Currency2 = "Rupees"; | |
const exchange_rate = 72; | |
news_string = "Today 100 " + Currency1 + " are trading for " + exchange_rate * 100 + " " + Currency2; | |
//The normal way | |
console.log(news_string); | |
//The template literal way | |
news_string_tl = `Today 100 ${Currency1} are trading for ${exchange_rate * 100} ${Currency2}`; | |
console.log(news_string_tl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment