javascript array methods
push(): Increases the length of an array by one or more elements and returns the new array length.
pop(): Takes the last element out of an array and gives it back.
shift() moves all ensuing elements to a lower index by removing the initial element from an array and returning it.
unshift(): Increases the length of an array by one or more elements and returns the new array length.
concat() creates a new array by combining two or more arrays without changing the original arrays.
slice(): Without changing the original array, this function takes a portion of an array and returns a new array.
splice(): Modifies an array's contents by inserting new elements in lieu of or deleting old ones.
these are some of them
Different types of Array methods?
1. Manipulation Methods:
push(), pop(),shift(), slice(), etc.
2. Searching and Sorting Methods:
sort(), find(),indexof(), etc.
3. Conversion Methods:
join(), concat(),tostring()
4. Iteration Methods:
foreach(), map(), filter(), etc.
5. Utility Methods:
isArray()
push(): used to add more elements to the end of an array
pop(): used to take out the last elements from an array
shift(): it is used to take out the first element from an array.
unshift(): adding more elements at the beginning of an array.
splice(): add or remove an element from a specific index in an array.
slice(): takes a part of an array and gives you a new array with just that part.
Test your knowledge with interactive quizzes.
Prepare for interviews with curated question sets.
Ask your coding-related doubts and get answers.
Earn certifications to enhance your resume.
Hands-on projects to improve your skills.
Test your knowledge with interactive quizzes.
Prepare for interviews with curated question sets.
Add your technical blogs and read technical topics.
Earn certifications to enhance your resume.
Hands-on projects to improve your skills.
People Also Asked |
---|