Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 1.77 KB

README.md

File metadata and controls

20 lines (18 loc) · 1.77 KB

Crockford-challenges

Challenges from Doug Crockford's JavaScript Good Parts course on Front-end Masters which can be found at https://frontendmasters.com/courses/javascript-the-good-parts/

My answers are written in both ES3/5 and ES6 (ES-2015)

  1. Write a function that takes an argument and returns that argument.
  2. Write two binary functions, add and mul, that take two numbers and return their sum and product.
  3. Write a function that takes an argument and returns a function that returns that argument.
  4. Write a function that adds from two invocations.
  5. Write a function that takes a binary function, and makes it callable with two invocations.
  6. Write a function that takes a function and an argument, and returns a function that can supply a second argument.
  7. Without writing any new functions, show three ways to create the inc function. Using functions from the previous six problems.
  8. Write methodize, a function that converts a binary function to a method.
  9. Write demethodize, a function that converts a method into a binary function.
  10. Write a function twice that takes a binary function and returns a unary function, that passes it's argument to the binary function twice.
  11. Write a function composeu that takes two unary functions and returns a unary function that calls them both.
  12. Write a function composeb thst takes two binary functions and returns a function that calls them both.
  13. Write a function that allows another function to be only called once.
  14. Write a factory function that returns two functions that implement an up/down counter.
  15. Make a revocable function that takes a nice function and returns a revoke function that denies access to the nice function, and an invoke function that can invoke the nice function until it is revoked.