Summary of some important method of Javascript

Introduction:

Javascript was created in 1995 by Brendan Eich when he was an engineer at Netscape. Javascript is first released in Netscape in 1996. from then javascript edited 6 times. Javascript is a scripting language that runs in a host environment like a browser, It also runs in a server site like Node.js

Types of Javascript:

There are seven main types of javascript have.

1) String,2) Number,3) Boolean,4) Symbol5)Null6)Undefined7) Object :a)Function(b)Array©Date(d)RegExp

1) String: String object use for representing and manipulating a sequence of characters. A string is useful for holding data in text form.

a)String.charAt(): string.charAt() method returns a new string consisting of the single unit of the character indicated by index number. If an index is out of range then charAt() will return an empty string and if no index is provided then charAt() will return 0. The first index of character is 0 and the last is -1 of string.length

example:

b)concat(): concat() method return a new string with combined of two or more string which is provided.

Example:

var str1 = “Hello “;
var str2 = “world!”;
var res = str1.concat(str2);//console.log=(Hello world!)

c)includes(): includes() method return true or false value after case-sensitive searching a string in another string. If a string value is found then it will show true else it will show false.

d)endsWith(): endsWith() method also return true or false value after search end value of a string. If provided string matches with the end of the searched string then it will show true else it will show false.

e)indexOf(): indexOf() method return the index number of searched matched string. It will return the first match string index number.

Example:

var str = “Hello world, I’m from Javascript”;
var n = str.indexOf(“from”);//console.log=6

f)lastIndexOf(): lastIndexOf() method return the index number of searched matched string but it will return last one. If there two same string then it will return the last string index number.

g)replace(): replace() method return new string after replaced first matches searched string. If there two same string then it will replace the first string other will not replace it.

h)slice(): slice() method return exact new string without modify the original string. In the slice() method there are two indexes that can pass from the index and end index and the result will show according to that. And if the end index not mentions then it will show from the begining index and will continue to the last index.

i)split(): split() method divided a string into an order list of substring and that all substring will return in an array. A string can split according to comma, character, word, or empty and if give any index number then it will show a specific string else it will show all number of the string in an array.

j)startsWith(): startsWith() method return true or false value after searched. If a string begins with a specified character of string then it will show true else will show false.

k)substr(): substr() method return specified number index string. If begging and ending index number mention then it will show according to that else if only begging index mention then it will show from begging index to end.

l)toLowerCase(): toLowerCase() method return converted lowercase string.

m)toUpperCase(): toUpperCase() method return converted uppercase string.

2)Number:

a)isNaN(): isNaN() method return true or false value.

b)parseInt(): parseInt() method parse a string and return a integer.Only the first number in the string will return and if the first character is not covered with a number then it will return NaN.

c)parseFloat(): parseFloat() method parse a string and return a integer with floating number. And is the same as the parseInt() method like only the first number in a string will return ad if the first character is not covered with a number then it will return NaN?

#Math: Math method does all mathematical tasks.

a)abc(): abc() mehtod return absolute value of a number.

b)ceil(): ceil() method return round a number upward to nearest integer.

c)floor(): floor() method return round a number downward to nearest integer.

d)min(): min() method return the number with lowest value.

e)max(): max() method return the number with highest value.

f)random(): random() method return a value between 0 to 1;

g)round(): round() method return a number to nearest integer.

h)sqrt(): sqrt() method return the square root of a number.

#Array: Array object used to store multiple values in a single variable.

a)concat(): Array concat() method use for join two or more array.

b)every(): Array every() method return true or false value. This method will check every element to its argument whether it’s matched or not.

c)filter(): filter() method will create a new array with the value of all passed arguments.

d)find(): find() method will return first element of matched argument.

e)findIndex(): findIndex() method return the index number of specific index by argument.

f)forEach(): forEach() method calls once for a element in array.

g)indexOf():

h)join():

i)map():

j)lastIndex():

k)pop():

l)push():

m)reduce():

n)reverse():

o)shift():

p)slice():

q)sort():

r)unshift()

This Article will continue……

I'm a professional web- developer || JavaScript || React