Showing posts with the label js

All Important Array Methods in JavaScript

Arrays are the type of data structure that are used to store multiple values at a time. We can access any element in the array by using its index value. For having operations on array methods are used. Here are some of the important array methods which are used in JavaScript: 1.concat(): It joins multiple or several arrays into one. array1 = [1,2,3,4,5]array2 = [3,5,6,7]array1.concat(array2) Result will be:[1, 2, 3, 4, 5, 3, 5, 6, 7] 2.copyWithin(): It copies array elements within the array, to and from a specified position, and overwrites the original array. It takes 3 parameters which are: target : index of the elements which are to be copied (required) start : index position to start copying elements from end : index up to which elements should be copied array = ['apple', 'banana', 'cherries', 'Dates', 'Entawak', 'Fig']array.copyWithin(3,0,2) Result will be:["apple", "banana", "cherries", "apple"

Popular posts from this blog

The Best 5 React Courses Available Online for Developers

These are the Best Bootstrap Courses Available Online

The 5 Best Online Logo Makers