- Array.prototype.myForEach = ...
- Object.defineProperty(Array.prototype, 'myForEach', { value: ...
https://repl.it/@CalebTaylor2/Wiseperson-generator-drill | |
https://repl.it/@CalebTaylor2/shouter-drill | |
https://repl.it/@CalebTaylor2/text-normalizer-drill |
https://repl.it/@CalebTaylor2/area-of-a-rectangle-drill | |
https://repl.it/@CalebTaylor2/temperature-conversion-drill | |
https://repl.it/@CalebTaylor2/Is-divisible-drill |
https://repl.it/@CalebTaylor2/Traffic-lights-drill | |
https://repl.it/@CalebTaylor2/Error-alert-drill |
https://repl.it/@thinkful/Array-length-and-access-drill | |
https://repl.it/@thinkful/Accessing-array-items-drill | |
https://repl.it/@thinkful/Adding-array-items-drills |
https://repl.it/@thinkful/Array-copying-I-drill | |
https://repl.it/@thinkful/Array-copying-II-drill | |
https://repl.it/@thinkful/Squares-with-map-drill | |
https://repl.it/@thinkful/Sort-drill | |
https://repl.it/@thinkful/Filter-drill | |
https://repl.it/@thinkful/Find-drill |
https://repl.it/@thinkful/min-and-max-without-sort-drill | |
https://repl.it/@thinkful/average-drill | |
https://repl.it/@thinkful/fizzbuzz-drill-js |
1. What is scope? | |
Scope is where the variable can used. A variable declared globally means that it can accessed everywhere including in local scopes | |
such as functions or conditional statements. | |
2. Why are global variables avoided? | |
Global variables will overwrite other variables with the same binding name in local scopes such as functions. This will lead to | |
unintended results. To avoid this, inside the function, redeclare that binding name so that it is set in that local environment. |
https://repl.it/@thinkful/Object-creator-drill | |
https://repl.it/@thinkful/Object-updater-drill | |
https://repl.it/@thinkful/Self-reference-drill | |
https://repl.it/@thinkful/Deleting-keys-drill |
// Array prototype method, however this is not safe, since it is added to the global scope | |
// definedProperty makes method non-enumerable as well as adding new property to in this case, to Array prototype | |
// Array prototype method, however this is not safe, since it is added to the global scope | |
// definedProperty makes method non-enumerable as well as adding new property to in this case, to Array prototype | |
Object.defineProperty(Array.prototype, 'mySort', { | |
value: function(callback) { | |
const mergeSort = arr => { | |
if (arr.length === 1) { | |
return arr; | |
} |