Arrays in Javascript
Assess your knowledge of arrays in Javascript by implementing the following functions.
We'll cover the following...
Assess your skills
Test your concepts of arrays by determining the location of an item in an array.
indexOf = function(arr, item) {}
Evaluate your concepts by populating an array.
sum = function(arr) {}
Evaluate yourself by returning a new array after removing all instances of a value from an array.
// Returns a new arrayremove = function(arr, item) {}
Evaluate yourself by removing all instances of a value from an array (modify the original array).
// Modifies the original arrayremoveWithoutCopy = function(arr, item) {}
Evaluate yourself by adding an item to the end of an array.
// Appends to the original arrayappend = function(arr, item) {}
Evaluate yourself by removing the last item of an array.
// Modifies the original arraytruncate = function(arr) {}
Test yourself by Adding an item at the beginning of an array.
// Prepends to the original arrayprepend = function(arr, item) {}
Test yourself by removing the first item of an array.
// Modifies the original arraycurtail = function(arr) {}
Test yourself by joining together two arrays.
// Returns a new array containg both arraysconcat = function(arr1, arr2) {}
Test yourself by adding an item anywhere in an array.
// Inserts an element in the original arrayinsert = function(arr, item, index) {}
Test yourself by counting the occurrences of an item in an array.
count = function(arr, item) {}
Test yourself by finding the duplicates in an array
// return all elements that occur more than onceduplicates = function(arr) {}
Test yourself by Squaring each number in an array.
// return a new array with each item squaredsquare = function(arr) {}
Test yourself by finding all the occurrences of an item in an array.
// return a new array containing all indexes of all occurances of the target itemfindAllOccurrences = function(arr, target) {}