JS Arrays + Problem Set.

Directory.

problem set.
js files

Blogging Question.
pop() – The pop method takes out the last element of the array
push() – The push method pushes a desired value into the array.
Unshift() – This method adds new items to the beginning of an array, and returns the new length.
shift() – This method removes the first item from an array and returns that removed item. 

arr = [ 1, 2, 3, 4];
arr.pop(); // pops the value 4
arr.push(4); // push value 4 back into array(last index)
arr.unshift(5) // pushes five into the begining of arrray
arr.shift()// removes the first index of the array

Many sites use arrays to represent data.
one example is this site.
the files are arranged in an array that is alphabetized.

Leave a comment

Your email address will not be published. Required fields are marked *

css.php