Last active
December 15, 2015 14:17
-
-
Save biglovisa/2f677a67ba8c49e34bbd to your computer and use it in GitHub Desktop.
JavaScript recursion exercises
This file contains 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
// Write a recursive function that outputs the range between two positive numbers | |
// myFunction(1, 5) #=> [1, 2, 3, 4, 5] | |
// (5 pts) | |
// Write a recursive function that outputs the sum of an array of integers | |
// myFunction([1, 2, 3, 4, 5, 6]) #=> 21 | |
// (5 pts) | |
// Implement Ruby's `select` in JavaScript recursively. | |
// Example: iterating over [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and only returning even numbers. | |
// (5 pts) | |
// Implement Ruby's `drop_while` in JavaScript recursively. | |
// Example: iterating over [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] and only returning integers greater than 7. | |
// drop_while: http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-drop | |
// (5 pts) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment