Advertisement
Guest User

Untitled

a guest
Oct 5th, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. ```js
  2. 'use strict';
  3.  
  4. var transform = function transform(value, predicate, mutator) {
  5. if (predicate(value)) {
  6. return mutator(value);
  7. }
  8. return value;
  9. };
  10. var height = 69;
  11. var isHeightInches = function isHeightInches(height) {
  12. return height < 100;
  13. };
  14. var inchesToCentimeters = function inchesToCentimeters(inches) {
  15. return height * 2.54;
  16. };
  17. height = transform(height, isHeightInches, inchesToCentimeters);
  18. console.log(height);
  19. height = transform(height, isHeightInches, inchesToCentimeters);
  20. console.log(height);
  21. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement