Skip to main content
Fixed the signature for parseFloat, it doesn't take a radix value.
Source Link
trincot
  • 357.1k
  • 38
  • 282
  • 338

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or floatfloats respectively  .
Syntax : -

Syntax:

 parseInt(string, radix); parseFloat(string); 

string : - it can be either a variable or a string itself .
radix :- (Optional, but highly encouraged) It is a numeric value between 2 - 36 , it represents the numeric system to be used.

  • string: the string expression to be parsed as a number.
  • radix: (optional, but highly encouraged) the base of the numeral system to be used - a number between 2 and 36.

Try this : -

Example:

 var x =  prompt("Enter a Value","10" "0"); var y = prompt("Enter a Value", "10""0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them  .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively  .
Syntax : -

 parseInt(string, radix); parseFloat(string); 

string : - it can be either a variable or a string itself .
radix :- (Optional, but highly encouraged) It is a numeric value between 2 - 36 , it represents the numeric system to be used.

Try this : -

 var x =  prompt("Enter a Value","10"); var y = prompt("Enter a Value", "10"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them  .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or floats respectively.

Syntax:

 parseInt(string, radix); parseFloat(string); 
  • string: the string expression to be parsed as a number.
  • radix: (optional, but highly encouraged) the base of the numeral system to be used - a number between 2 and 36.

Example:

 var x = prompt("Enter a Value", "0"); var y = prompt("Enter a Value", "0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them.

Changed radix value from 0 to 10. As the answer states, radix value must be between 2 and 32. Also fixed the signature for parseFloat, it doesn't take a radix value.
Source Link

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string,radix); 

string : - it can be either a variable or a string itself .
radix :- (Optional, but highly encouraged) It is a numeric value between 2 - 36 , it represents the numeric system to be used.(Not for parseFloat() ) .

Try this : -

 var x = prompt("Enter a Value","0""10"); var y = prompt("Enter a Value", "0""10"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string,radix); 

string : - it can be either a variable or a string itself .
radix :- (Optional) It is a numeric value between 2 - 36 , it represents the numeric system to be used.(Not for parseFloat() ) .

Try this : -

 var x = prompt("Enter a Value","0"); var y = prompt("Enter a Value", "0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string); 

string : - it can be either a variable or a string itself .
radix :- (Optional, but highly encouraged) It is a numeric value between 2 - 36 , it represents the numeric system to be used.

Try this : -

 var x = prompt("Enter a Value","10"); var y = prompt("Enter a Value", "10"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

added 25 characters in body
Source Link
Anurag-Sharma
  • 4.4k
  • 5
  • 31
  • 42

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string,radix); 

string : - it can be either a variable or a string itself .
radix :- (Optional) It is a numeric value between 2 - 36 , it represents the numeric system to be used.(Not for parseFloat() ) .

Try this : -

 var x = prompt("Enter a Value","0"); var y = prompt("Enter a Value", "0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string,radix); 

string : - it can be either a variable or a string itself .
radix :- (Optional) It is a numeric value between 2 - 36 , it represents the numeric system to be used.

Try this : -

 var x = prompt("Enter a Value","0"); var y = prompt("Enter a Value", "0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

parseInt() or parseFloat() are functions in JavaScript which can help you convert the values into integers or float respectively .
Syntax : -

 parseInt(string, radix); parseFloat(string,radix); 

string : - it can be either a variable or a string itself .
radix :- (Optional) It is a numeric value between 2 - 36 , it represents the numeric system to be used.(Not for parseFloat() ) .

Try this : -

 var x = prompt("Enter a Value","0"); var y = prompt("Enter a Value", "0"); var num1 = parseInt(x); var num2 = parseInt(y); 

After this you can perform which ever calculations you want on them .

added 106 characters in body
Source Link
Anurag-Sharma
  • 4.4k
  • 5
  • 31
  • 42
Loading
Source Link
Anurag-Sharma
  • 4.4k
  • 5
  • 31
  • 42
Loading