Javascript Methods short discussion
Published: 2021-06-13 19:56:03

> Array Methods

1.concat()

concat() is an array javascript method using for adding two or more arrays. It returns a new array for adding two or more arrays. You use concat method parameter in the second array name or using direct value. It is added the old/first array and returns a new array.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ez9syghv4m1e09qh6m16.JPG)

2.find()

find() is the javascript array method. it is using to search an array element in the array. The find method parameter you can provide a callback function then set your condition in the callback function. After the condition is true return this element otherwise return undefined.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/la8mqegjov870sfvklzn.JPG)

3.findIndex()

findIndex method using for find array element index, you can provide a callback function in findIndex parameter then set the condition in callback function after matching the condition then return 1 otherwise return -1

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhyjkzrymz55634mrby1.JPG)

4.filter()

filter method using for filter arrays. filter parameter must provide a callback function then set your condition in a callback function. Check the condition of all array elements. Then With those element conditions that have been true then return a new array for this element.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dksk5ucfvfecmk1h7n9d.JPG)

5.pop()

pop method using for the array the last element removed. If you use the pop method then remove the last element in your array and return this element.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t9v96n15utsxpwg0h2kl.JPG)

6.shift()

shift method using for the array first element removed. If you use the shift method then remove the first element in your array and return this element.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7t0rwqjybf7wqanh256w.JPG)

7.push()

push method using to add a new element in the array and a new element is added to the last element in the array and return this array length.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4cse5ls0vy7uun5za3pv.JPG)

8.unshift()

unshift method using to add a new element in the array and a new element is add the first element in the array and return this array length.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ucvr6iy6lc0ltr1ve91.JPG)

9.reverse()

reverse method is using for reverse array elements. If you use this method reverse all elements in your array and return this array.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jx2y9jxbjs6vwp7mrzfr.JPG)

10.join()

join method is using for converted all array elements to string. you use this method then return a string for all elements. You do not use any parameter in the join method parameter then add a comma by default in the middle for all elements and return this string, or you use an empty string then return only all elements.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvgpjcwfxj9dsrg83yqy.JPG)

> String Methods

1.charAt()

charAt method is using for a letter in the string. You provide a parameter then return this index letter or by default return, the first index letter but your provided parameter is bigger than the array length then return an empty string.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/inxdqhl9ixmv40ok1owk.JPG)

2.concat()

concat() method used for adding two or more strings. It returns a new string for adding two or more strings. You use concat method parameter in the second variable name or using direct value. It is added the old/first string and returns a new string.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/08iu447x1x5c8rdytm6x.JPG)

> Math Methods

1.abs()

abs method is using for a negative number converted to a positive number and it is returning this converted number.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjfzour3ch1ec6ryusus.JPG)

2.max()

The max method is using for two number difference and it is returning the maximum number.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xugcrhm5yqb1em66c9ea.JPG)

3.min()

The min method is using for two number difference and it is returning the minimum number.

example:
![Example Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6yrxmwbvcdq5khv6o2e9.JPG)