Built-in function

Built-in function are the one that are stored in library and need not be written again where as user defined function are declared and defined by the user or programmer as par the coding requirement.

JavaScript provide many inbuilt function are: evel(), parseInt() and parseFloat().

Evel():- This function convert a string expression to a number value.

Example
var price-Tolal=eval ("10*10+10);
result in the value 110 begin assigned to the varible price-Total.

parseInt ():- This function is used to convert a string value to an integer parseInt () returns. The first contained in a string or 0 if the string does not begin with an Integer.

Example

var string 2num=parseInt("123xyz");

results in the integer 123 begin assiged to the variable string 2num.
 
var string 2num-parseInt("xyz");

 result in NaN (not a numver) begin assiged to the variavle string 2num.

parseFloat():- This function returns the first floating point number contained in a string or 0 if the string not begin with a valid point number.

Example 
var string 2num=parseFloat("1.3xyz");
result in the floa 1.3 begin assiged to the variable string 2num.
var string 2num=parseFloat("xyz");
result in "NaN"(not a number) begin assiged to the variable string 2num.

Leave a Reply