Day 18  of #100daysofjs

Photo by Andrew Neel on Unsplash

Day 18 of #100daysofjs

Some More JavaScript Array Methods

sort()

sort() method is used to sort an array alphabetically.

sort() takes an optional compare function. If this function is provided as the first argument, the sort() function will consider these values (the value returned from the compare function) as the basis of sorting.

splice()

Splices can be used to add new items to an array

slice()

slice out a piece from an array it creates a new array.

Code