Enforce required parameters

05/07/20181 Min Read — In JavaScript, ES6
const throwIfMissing = () => {
  throw new Error('You have missing param!');
};
const func = (requiredParam = throwIfMissing()) => {
  // your code here
};