Javascript build in function

Javascript is the most popular programming language in the world now a days.There are few build in function in javascript that should be know for developer. Today I will discuss few javascript build in function. They are as follows:

String:

The JavaScript string is an object that represents a sequence of characters. We denotes string into double or single quotation. There are few javascript string methods. They are as follows:

charAt():

charAt() is one of the javascript build in method. It provides the char value present at the specified index.

Concat():

The concat() function concatenates the string arguments to the calling string and return a new string. It provides a combination of two or more strings.

indexOf():

The JavaScript string indexOf() method is used to search the position of a particular character or string in a sequence of given char values. This method is case-sensitive.

The index position of first character in a string is always starts with zero.

slice():

The JavaScript string slice() method is used to fetch the part of the string and returns the new string. It required to specify the index number as the start and end parameters to fetch the part of the string. The index starts from 0.

replace():

The JavaScript string replace() method is used to replace a part of a given string with a new substring. This method searches for specified regular expression in a given string and then replace it if the match occurs.

Array:

Javascript array is an object that represent the collection of similar type of elements. There are some build in function of array. They are as follows:

Concat():

The JavaScript array concat() method combines two or more arrays and returns a new string. This method doesn’t make any change in the original array.

Syntax: array.concat(arr1,arr2,….,arrn)

every():

The JavaScript array every() method checks whether all the given elements in an array are satisfying the provided condition. It returns true when each given array element satisfying the condition otherwise false.

Syntax: array.every(callback(value))

filter():

The JavaScript array filter() method filter and extract the element of an array that satisfying the provided condition. It doesn’t change the original array.

Syntax: array.filter(callback(currentvalue))

find():

The JavaScript array find() method returns the first element of the given array that satisfies the provided function condition.

Syntax: array.find(callback(value))

forEach():

The JavaScript array forEach() method is used to invoke the specified function once for each array element.

Syntax: array.forEach(callback(value))

map():

The JavaScript array map() method calls the specified function for every array element and returns the new array. This method doesn’t change the original array.

Syntax: array.map(callback(value))

push():

The JavaScript array push() method adds one or more elements to the end of the given array. This method changes the length of the original array.

Syntax: array.push(element1,element2….elementn)

Pop():

The JavaScript array pop() method removes the last element from the given array and return that element. This method changes the length of the original array.

Syntax: array.pop()

shift():

The JavaScript array shift() method removes the first element of the given array and returns that element. This method changes the length of the original array.

Syntax: array.shift()

unshift():

The JavaScript array unshift() method adds one or more elements in the beginning of the given array and returns the updated array. This method changes the length of the original array.

Syntax: array.unshift(element1,element2,….,elementn)

Splice():

The JavaScript array splice() method is used to add/remove the elements to/from the existing array. It returns the removed elements from an array. The splice() method also modifies the original array.

Syntax: array.splice(start,delete,element1,element2,?,elementn)

There are many more build in function in javascript. I discuss some of them. As a javascript developer we will know more javascript build in function. In future I will discuss more javascript build in fucntion insha allah.