akram.dag avatar

Why not to use string concatenation with variables

akram.dag

Published: 19 Dec 2019 › Updated: 19 Dec 2019Why not to use string concatenation with variables

Why not to use string concatenation with variables

#JS-BEGINNERS-SERIES #lesson-001

Why not to use string concatenation with variables

Many beginner developers use the string concatenation to match variables with text

Example :
code002.png

But there is an easier way to code this output, which is using the string interpolation used in the ES6 version of javascript. Wich means replacing the quotation marks “” and the plus signs + with a template literal.
A template literal is wrapped by backticks `` and contains a placeholder ${variable} wich contains the variable

Example :

Leave Why not to use string concatenation with variables to:

Written by

Read more #js-beginners posts


Best Posts From akram.dag

We have not curated any of akram.dag's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From akram.dag