JavaScript string interpolation
concatenating strings with variables in a neater way
This requires JavaScript ES6 and beyond
When concatenating strings with variables in old JavaScript, we can encounter things like this:
Obviously, this can become very error-prone with all these 'plusses' and 'quotations'!
However, in ES6, we could use something called string interpolation to make it more readable:
Note the one key thing of using backticks (the `
symbol) instead of quotations when using string interpolation! The sentence variable now reads more like a sentence!
Last updated