Top 10 important methods of JavaScript

1. length

When we find length of array or string then we can use this method.

2. toUpperCase();

We can use this methods to convert all character to capital letter format.

3. toLowerCase();

We can use this methods to convert all character to small letter format.

4. map()

It’s a very important method for array. We can say, this method is a shortcut form of the for loop.

5. filter()

filter is similar to map method but we can use any kind of condition in filter methods and find matched elements collection.

6. find();

find is similar to filter method but in this method find just return only one value. find method cannot return multiple values.

We can see the code example. find method just print only 9 but we used the condition elements>6. greater than 6 values are 7,8,9,10. But our code only print 9. It cannot print 7,8,10 why?

Because if see the array then you can see we have two 9 and one 8 and one 10 in our array. So when 9’s quantity are big than others element so it printed only 9. find method return one value also it depends of elements quantity then decide the return best value.

7. sort();

It’s a basic sort method. It’s very useful methods. We can set ascending / descending order.

8. reverse();

We can use this method to reverse an array.

9. parseInt();

When we can convert a string to number format then we can use this method. And it’s a very very useful method for every developers.
We can’t calculate any string type number.

Lets Try.

7 is a string format because it’s inside of double quotes. When we try to addition by 1 the output will be 71. Because its not a number.
we need to convert number then the output will be right.

10. Date

We can track our every time with this method. If you don’t have any clock you can use this method. just simple way,
Step1: Open Your Browser
Step2: Go to inspect element
Step3: Go to console tab
Step4: Type new Date()
Step:5 Press Enter (Boooom)
Just see the magic you can see your current time date everything.

Actually Date is a object. And Date have many methods. If you can see only year / time / specific time then you must use these methods.

Source W3School

You will try others methods.

Web Developer