A programmer should use a language as a tool, always taking advantage of language-specific data types and built-in functions.
Public questions (free account) are common interview questions. They are great for practicing, or if you want to filter candidates using the classic problems.
Implement the ensure function so that it throws an error if called without arguments or the argument is undefined. Otherwise it should return the given value.
- No argument throws an error: Wrong answer
- Truthy argument returns argument: Wrong answer
- Falsy argument is treated differently from undefined: Wrong answer