That’s a great point — it comes down to personal preference

There’s nothing wrong with using the plus sign + for string concatenation, though it can make HTML hard to read.

Hey Mohan C, thanks so much for reading!

You’re definitely right that it can be easier at times to read “simple” string concatenation just using the + sign:

const hello = "Hello "
const world = "World!"
console.log(hello + world) // Hello World!

On the other hand, I find it gets a lot messier when you need to include a lot of spaces or other punctuation:

const name = "Mohan"
console.log("Say hello to" + " " + name + " " + "for me!")

And multi-line HTML is basically unreadable, especially if you include indenting in your code:

const someHTML = "<html>\n  <head>\n    <title>A page</title>\n  </head>\n  <body>\n    <p>Wow this is getting hard to read</p>\n  </body>\n</html>"
console.log(someHTML)
document.write(someHTML)

But if that’s still easy for you to read, then be my guest! JavaScript really doesn’t care, and code readability is super important.

Another reader pointed out that webpack or Babel will transpile your code to remove backtick literals anyway, at least if you’re supporting ES5 and IE.

Thanks so much for taking the time to respond! Cheers!

Written by

🤓 The physical therapist who writes JavaScript 💪 Web Developer 😎 Mentor 🧠 DPT 😄 SEO Expert 😁 React 😆 Jamstack 🗯️ Ask me anything 👉 DoctorDerek.com 👈

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store