1. Primitive Data Type,
2. Non-Primitive Data Type.
- Primitive Data Type:
* Symbol (new in es6)
- Non-Primitive Data Type:
Today, I will discuss some of them.
In program we need to write strings with some rules and sytex, such as every string has start with (“) and end with (”), single/double quotes you can use one of them.
String has some methods to help our program effective and easy. Method is like a function but it define in a object. let’s go to know some String methods in bellow:
if we provide any index number of charecter in charAt(), then it will return to us that “charecter” which belongs to the string index. look at the example:
Somethime you need to concat two different strings in one string, then concate() method work exactly same:
You get some text with Unnecessary white space in string, you can’t remove those by hand then trim() method is so helpfull in this situation:
the last one I want to discuss about is not a method, it’s a property called “length”. It’s pretty usefull to know about string length or how many charecters have. Example:
This is a property and it has no () like methods.
To check the number is a number or not, some tyme you can get something like undefined, null, string then you can check the variable is it number or not. Look like be carefull before to get error. isNAN returns true or false,
To convert any floating number to integer you can use pareseInt() method.
To convert any integer number to float numer you can use pareseFloat() method.
To check a number is integer or not, if the number is integer then this method return true otherwise false.
Same as isInteger() method just this is to check the number infinity or not.
Array is a list/collection of data. In variable you can store one data, some situation you need to stroe more than one data then array solve this problem.
you can called an array using .
Let discuss about some array method:
this methods are use to manipulate your arrays.