STRINGS IN JAVA SCRIPT
STRINGS IN JAVA SCRIPT
Backticks: `Hello`
For example,
//strings example
const name = 'Peter';
const name1 = "Jack";
const result = `The names are ${name} and ${name1}`;
Single quotes and double quotes are practically the same and you can use
either of them.
However, the quote should not match the surrounding quotes. For
example,
JavaScript is Case-Sensitive
To find the length of a string, you can use built-in length property. For
example,
const a = 'hello';
console.log(a.length); // 5
let a = 'hello';
a[0] = 'H';
console.log(a); // "hello"
However, you can assign the variable name to a new string. For example,
let a = 'hello';
a = 'Hello';
console.log(a); // "Hello"