DEV Community

Avishek Talukder
Avishek Talukder

Posted on • Updated on

10 Important Functions Of JavaScript

JavaScript is one kind of programming language as well as web developing language. I am trying to discuss some topic of JavaScript String & Array below:

String

Includes: If we want to find a word or string in another string, we use the includes function. It uses an if-else function to search the specific word or string is there or not.
indexOf: It helps us to know the index number of a string in another string. The index number of a string always starts at 0 and ends at [string.length - 1].
replace: It is used to replace one string with another in one string. In another word, it returns a new string.
slice: This method helps to extract a section from a string & returns it as a new string. the format of this method is [start, end]
split: It uses to divide a string from the main string, then the divided string puts in an array, & then this method returns that array to the user.

Array

filter: It works using a condition that applies to the main array, as a result, it returns a new array according to the condition.
forEach: It helps to return all strings or elements individually of an array.
join: It creates and returns a new array from the main array using a separator. The separator can be a comma, hyphen or space.
map: It is used to pass a function in every string or element of an array.
push: It helps to add a new object in the main string & increase it's length.

Top comments (0)