Common ES6 Mistakes
Two ES6 gotchas worth knowing: destructuring defaults don't kick in for null (only undefined), and strings are iterables, so new Set('555') gives you a set with one element.
const myObject = {
emails: null
}
const { emails = [], users = [] } = myObject;
console.log(users.length); // users is undefined (defaults to []) This returns 0.
console.log(emails.length); // this will bork; you can't get length of null.Strings are iterables
const set = new Set('555')
console.log(set); // {'5'}More to come as I continue to make more mistakes...