Tip #24. A must have function argument | 50 tips on JavaScript book Printed version eBook Illustrations All tips A must have function argument~ Implementations ~ As we know, JavaScript is not a strictly typed language. We don't have types by default. That is why a big part of the community started using alternatives (like TypeScript). Which is a good solution, but most of them work at build time. Once our code is transpiled and bundled, the type checks are gone. Some time ago, I found a neat way to make a function argument required, even at runtime. function required() {   throw new Error(`Missing argument.`); } function shoppingCenter(time, money = required()) {   return {     time,     money,   }; }