
Template Literals > Your Old Code
Few day ago i noticed my friend still using the same old code for string concatenation i mean it good but it gets messy and hard to read when the code gets bigger In this blog we will cover : Traditional string concatenation Template literal syntax Multi-line strings Use cases in modern JavaScript Traditional string concatenation Before we get into t* emplate literals * lets see the old traditional way In this you have to use + symbol when you want to concatenate the strings const userName = " kunal " const balance = 100 const str1 = ' Hi ' + userName + ' , ' + ' your balance is ' + balance + ' . ' console . log ( str1 ) Output of the above code Hi kunal , your balance is 100. Note how using regular string involves adding many + symbols also you have to add white spaces too at right place. This can get difficult and hard to read over time when your code get lengthy with template literals you can do this easily. let see Template literal Template literals are the ES6 feature in JavaScrip
Continue reading on Dev.to
Opens in a new tab

