Weird JS Challenge - Build this API
Harrison Reid
Posted on January 31, 2019
TIL about a JavaScript feature I'd never seen before. I've used it to create the (super basic) calculator API shown below.
The challenge, should you choose to accept it, is to recreate this (or a similar API) yourself. If you're anything like me, you'll learn a bunch!
// Using the calculator!
calculator.one.plus.two.plus.three.equals
=> 6
calculator.two.plus.four.plus.seven.plus.eight.equals
=> 21
Hint: The solution is not to just use a single object with heaps of very deeply nested properties 😛
💖 💪 🙅 🚩
Harrison Reid
Posted on January 31, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.