Home > unshift()

JavaScript: What is the difference between shift() and unshift() array methods?

Definition: shift(): this method is use to remove first element of an array and returns new array. unshift(): this array method is used to add one or more arrays in existing array list and returns new array. usages of shift(): [crayon-69556523909f5187450782/] usages of unshift(): [crayon-69556523909fb430849275/]  

This Article is TAGGED in , , , . Read more

Array functions in javascript

Javascript array functions 1. toString() - convert array to string [crayon-6955652390ffc199160824/] 2. pop() - remove/delete last element from an array [crayon-6955652391001447384404/] 3. push() - add/insert element at the top [crayon-6955652391003099972652/] 4. shift() - remove/delete first element from an array [crayon-6955652391004500579857/] 5. unshift() - add/insert element at first position [crayon-6955652391006409429844/] 6. concat() - merged(concat) existing array and create new array [crayon-6955652391008424841584/] 7. slice() -

This Article is TAGGED in , , , , , , , . Read more