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
'use strict'; | |
/*****************NATIVE forEACH*********************/ | |
Array.prototype.myEach = function(callback) { | |
for (var i = 0; i < this.length; i++) | |
callback(this[i], i, this); | |
}; | |
//tests |
You are managing a sales team and you are interested is analyzing some data related to their age and total sales. Take a moment to review the following data structure you will be analyzing:
var salesTeam = [{name: {first: 'Aleen', last: 'Atkins'}, age: 26, sales: '$2314'},
{name: {first: 'Alvaro', last: 'Angelos'}, age: 55, sales: '$1668'},
{name: {first: 'Denese', last: 'Dossett'}, age: 29, sales: '$9248'},
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
// Super basic assertion | |
// console.log(square(2) === 4); | |
// Now, let's try writing an assertion that gives us a little more information about what's going on. | |
/* Write a function, assertEqual, that takes in 3 arguments: | |
- An invocation of the function you're testing | |
- The expected output of the function you're testing |
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
/* | |
Last time | |
* Conditionals (rps mini game) | |
This time | |
* Functions | |
* Iteration (for and while loop) | |
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
var library = { | |
books: { | |
orwell: ['1984', 'animal farm'], | |
hemingway: ['A Farewell to Arms', 'The Old Man and the Sea', 'The Sun Also Rises'] | |
}, | |
plays: { | |
shakespeare: ['romeo and juliet', 'macbeth'] | |
} | |
}; |
OlderNewer