Required Parameters for Functions in JavaScript
Ooo this is clever! I’m snagging this from David’s blog.
const isRequired = () => { throw new Error('param is required'); };
const hello = (name = isRequired()) => { console.log(`hello ${name}`) };
// These will throw errors
hello();
…