JavaScript, ES6
const throwIfMissing = () => { throw new Error('You have missing param!'); }; const func = (requiredParam = throwIfMissing()) => { // your code here };