Correct way to create strings in JavaScript
In this tutorial, we are going to learn about how to create the strings in JavaScript with the help of examples.
There three ways to create a strings in JavaScript.
- The first way is using single quotes
''
.
const str = 'Hello'
- The second way is using the double quotes
""
.
const str = "Hello"
- The final way of creating a string is using the backticks which is introduced in es6.
const str = `Hello`