Ah, the venerable string data type. It has some of the basics you'd expect, such as a length property and the slice() and split() methods, but two that always trip me up are substr() and substring():
"hello world".substr(3,5) // returns "lo wo"
"hello world".substring(3,5) // returns "lo"
The difference between the two methods is that the first one specifies (start, length), while the second specifies (start, end index). A handy way to remember the difference is that .substring() has an "i" in the name, correlating with index—the place in the string at which to stop.
A new addition in ES6 that makes our life easier is template literals. Take a look at this log:
const name = "Bob"
let age = 50
console.log("My name is " + name + " and I am " + age + " years old.")
It will work, but it's a little clunky. Let's use template literals:
console.log(`My name is ${name} and...