- WebDev repository for Assignment2
-
Consider the following JavaScript methods:
- { forEach, Map, Filter, Some, Every, Reduce, Includes, indexOf, Push, lastIndexOf, Object.keys(), Object.values() }
-
forEach()
- Without using the native “Array.prototype.forEach” method of JavaScript, compose a function titled “myEach” that will take in an array of elements and execute any callback function on each of those elements.
-
map()
- Without using the native “Array.prototype.map” method of JavaScript, compose a function titled “myMap” that will take in an array of elements and execute a callback function on each of those elements.
-
filter()
- Without using the native “Array.prototype.filter” method of JavaScript, compose a function titled “myFilter” that will take in an array of elements and execute a callback function on each of those elements.
-
some()
- Without using the native “Array.prototype.some” method of JavaScript, compose a function titled “mySome” that will take in an array of elements and execute a callback function on each of those elements.
-
every()
- Without using the native “Array.prototype.every” method of JavaScript, compose a function titled “myEvery” that will take in an array of elements and execute a callback function on each of those elements.
-
reduce()
- Without using the native “Array.prototype.reduce” method of JavaScript, compose a function titled “myReduce” that will take in an array of elements and execute a callback function on each of those elements.
-
includes()
- Without using the native “Array.prototype.includes” method of JavaScript, compose a function titled “myIncludes” that will take in an array of elements and indicate whether or not a target element is contained within the input array. This returns a boolean.
-
indexOf()
- Without using the native “Array.prototype.indexOf” method of JavaScript, compose a function titled “myIndexOf” that will take in an array of elements and returns the index of the first encounter of a target element (if it is found) or -1 if that element does not exist within the input array.
-
push()
- Without using the native “Array.prototype.push” method of JavaScript, compose a function titled “myPush” that will take in an array of elements as well as an elementToAdd and append that element to the end of the array.
-
lastIndexOf()
- Without using the native “Array.prototype.lastIndexOf” method of JavaScript, compose a function titled “myLastIndexOf” that will take in an array of elements and returns the index of the last encounter of a target element (if it is found) or -1 if that element does not exist within the input array.
-
Object.keys()
- Without using the native “Object.keys()” method of JavaScript, compose a function titled “grabKeys” that will take in an object and return all of the keys of the key:value pairs of that object.
-
Object.values()
- Without using the native “Object.values()” method of JavaScript, compose a function titled “grabValues” that will take in an object and return all of the values of the key:value pairs of that object.