Posts

Showing posts with the label javascript arrays

JavaScript - Arrays

Image
  JavaScript Arrays Today’s topic JavaScript arrays and some of its most used methods. What are Arrays ?  Arrays re used to store more than one value at a time Arrays are special variables.  Syntax: const array_name = [ n 0 , n 1 , n 2 , n 3 , n n ]; Eg: This is the basic way for creating an array.  Types of arrays (1) Uniform -  An array which has a single type of data. Eg - Uniform array. (2) Un uniform - An array which has multiple types of data. Eg - Un uniform array. (2) Dimensional Array - A simple description would be the 2D Array are Arrays of Arrays.  Eg - 2D array. The Array.from( ) :   It takes an array-like object & turns it into a complete array, or you can say does a shallow copy. In which you can perform all array functions.  Syntax : Array from (arrayLike, mapfn, thisarg)  arrayLike An array-like or iterable object to convert to an array . mapFn Optional Map function to call on every element of the array . thisArg ...