Ensure


JavaScript Language Public

Easy  

3min

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.

ECMAScript 6
   

  •   No argument throws an error: Wrong answer
  •   Truthy argument returns argument: Wrong answer
  •   Falsy argument is treated differently from undefined: Wrong answer