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
Array.prototype.map = function(projectionFunction) { | |
var results = []; | |
this.forEach(function(itemInArray) { | |
results.push(projectionFunction(itemInArray)); | |
}); | |
return results; | |
}; |
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
Queue Builder | |
The devs at Poplar Puzzles would like you to treat an array of functions like a | |
Queue, passing the result of each function into the next until the Queue is empty. | |
They’ve sent you the puzzlers Queue of functions, and the following instructions: | |
Build a function and assign it to a variable named applyAndEmpty. | |
The function should take in an input number and a queue of functions as parameters. | |
Using a for loop, call the functions in the queue in order with the input | |
number, where the results of each function becomes the next function’s input. |
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
The folks over at Poplar Puzzlers need an array of functions for one of their puzzles. They’ve requested your help in making the array, which they would like to be called puzzlers. The cells of the array should each contain a function, and these functions–well, what they return–are listed here in order. Each function has one parameter. Note input below represents the parameter, and you will need to convert the math formulas to JavaScript: | |
Returns 3 * input - 8 | |
Returns (input + 2)3 | |
Returns input2 - 9 | |
Returns input % 4 | |
Use your knowledge of arrays and anonymous function expressions to build this array of functions. | |
Note: Use parentheses with your return statements if you’re having trouble with the order of operations. |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Bootstrap Layouts</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="styles/main.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<!-- Optional theme --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> | |
</head> |
NewerOlder