DEV Community

Tandap Noel Bansikah
Tandap Noel Bansikah

Posted on • Updated on

JavaScript array methods

In this article, I will like to talk about javascript array methods but first of all, I will like us to know what an array is.

An array is in an ordered list of values. Each value is called an element specified by an index: A javascript array has the following characteristics: First, an array can hold values of mixed types. For example, you can have an array that stores elements with the types number, string, boolean and null.

Javascript methods: are actions that can be performed on objects. A javascript method is a property containing a function definition

Now Back to the main deal of today, I will like to highlight some important javascript methods just a few, it is not like the others are not important you can check on them if you want to know more in detail. You can see that below.

[4, 5, 6, 7].at(1)         // 5
[4, 5, 6, 7].push(8)       // [4, 5, 6, 7, 8]
[4, 5, 6, 7].pop()         //[4, 5, 6, ]
[4, 5, 6, 7].fil(1)        //[1, 1, 1, 1]
[4, 5, 6, 7].join(' ')     //'4 5 6 7 '(string)
[4, 5, 6, 7].shift()       //[ 5, 6, 7]
[4, 5, 6, 7].reverse()     //[7, 6, 5, 4]
[4, 5, 6, 7].unshift(3)    // [3, 4, 5, 6, 7]
[4, 5, 6, 7].includes(6)   //true
[4, 5, 6, 7].map(item => 2*item) // [8, 10, 12, 14]
[4, 5, 6, 7].filter(item => item > 5)  //[6,7]
[4, 5, 6, 7].find(item => item > 5)    //6 (first match)
[4, 5, 6, 7].every(item => item > 0)   // true
[4, 5, 6, 7].findIndex(item => item === 5)  // 1
[4, 5, 6, 7].reduce((prev, curr) => prev+curr, 0)   //22
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
jagroop2001 profile image
Jagroop Singh

If you share this in the code or text format instead of just image then it would be great !!

Collapse
 
bansikah profile image
Tandap Noel Bansikah

ok thank you very much noted