javascript string ${} code example
Example 1: is string javascript
function isString(value) {
return typeof value === 'string' || value instanceof String;
}
isString(''); // true
isString(1); // false
isString({}); // false
isString([]); // false
isString(new String('teste')) // true
Example 2: string interpolation javascript
const age = 3
console.log(`I'm ${age} years old!`)
Example 3: js string
String(thing)
Example 4: js string
return 'cat'[1]; // returns "a"