This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| All about mocha |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Node.js CheatSheet. | |
| // Download the Node.js source code or a pre-built installer for your platform, and start developing today. | |
| // Download: http://nodejs.org/download/ | |
| // More: http://nodejs.org/api/all.html | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Simple problems to solve using the native .reduce and .map array methods. Each of these problems can be solved in many | |
| // different ways, but try to solve them using the requested higher order function. | |
| // MAP | |
| // Write a function capitalize that takes a string and uses .map to return the same string in all caps. | |
| // ex. capitalize('whoop') // => 'WHOOP' | |
| // ex. capitalize('oh hey gurl') // => "OH HEY GURL" | |
| var capitalize = function(string){ | |
| // code code code! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Example 1 - Calculate average value of an array (transform array into a single number) | |
| var scores = [89, 76, 47, 95] | |
| var initialValue = 0 | |
| var reducer = function (accumulator, item) { | |
| return accumulator + item | |
| } | |
| var total = scores.reduce(reducer, initialValue) | |
| var average = total / scores.length | |
| /*Explain about function |