Tag Archives: Math in JavaScript

Calculate arctangent of a number in JavaScript

  You can add get arctangent of a number through math.atan function in javascript. you can use this function like: Math.atan(number) where number is a number for which the arctangent is needed. Note: The return value is the arctangent of the number argument, in radians. Example <html> <body> <script language="JavaScript"> <!– function CalculateResult(){ var Number1=document.form1.txtNumber1.value; … Continue reading Calculate arctangent of a number in JavaScript

Calculate ceiling of the any number through math.ceil() function

  Math.ceil function returns the smallest integer greater than or equal to its numeric argument. You can use this function as : Math.ceil(number) where number is the number. The return value is an integer value equal to the smallest integer greater than or equal to its numeric argument. Example <html> <body> <script language="JavaScript"> <!– function … Continue reading Calculate ceiling of the any number through math.ceil() function

Math.exp Function in JavaScript

  math.exp function in javascript returns e raised to a power. You can use this like : Math.exp(number) where number is a numeric expression representing the power of e. Note: constant e is Euler’s number, approximately equal to 2.71828 and number is the supplied argument. <html> <body> <script language="JavaScript"> <!– function CalculateResult(){ var Number1=document.form1.txtNumber1.value; var … Continue reading Math.exp Function in JavaScript

How to use math.pow() method in javaScript

  you can calculate the value of a base expression taken to a specified power with the help of math.pow() function. you can use this method like as: Math.pow(base, exponent) where base is the base value and exponent is the exponent value of the expression. Example: <html> <body> <script language="JavaScript"> <!– function CalculateResult(){ var Number1=document.form1.txtNumber1.value; … Continue reading How to use math.pow() method in javaScript

Rounding a numerical value in JavaScript

  In JavaScript math.round() method rounds a number to its nearest integer value. Suppose If the fractional portion of the number is .5 or greater, the result is rounded to the next highest integer and if the fractional portion of number is less than .5, the result is rounded to the next lowest integer. for … Continue reading Rounding a numerical value in JavaScript

Math.round() method in JavaScript

  In JavaScript math.round() method rounds a number to its nearest integer value. Suppose If the fractional portion of the number is .5 or greater, the result is rounded to the next highest integer and if the fractional portion of number is less than .5, the result is rounded to the next lowest integer. for … Continue reading Math.round() method in JavaScript

How to calculate absolute value of number in JavaScript

  You can calculate absolute value of a any number with the help of math.abs() method in JavaScript You can use this methods as : Math.abs(number) where number is number for which the absolute value is needed. see this : <script type="text/javascript"> document.write(Math.abs(23.7) + "<br />"); document.write(Math.abs(-23.7) + "<br />"); document.write(Math.abs(5-10)); document.write(Math.abs(null) + "<br />"); … Continue reading How to calculate absolute value of number in JavaScript

How to get the maximum value among two numbers in JavaScript

  In JavaScript you can use the math.max() method for finding largest number among two or three numbers Example: <html> <head> <title>How to get the maximum value among two numbers in JavaScript</title> <script language="JavaScript"> <!– number1 = 56; numner2 = 43; document.write("The largest number among these two numbers is " + Math.max(number1 , number2)); // … Continue reading How to get the maximum value among two numbers in JavaScript

How to get the minimum value among two numbers in JavaScript

  In JavaScript you can use the math.min() method for finding smallest number among two or three numbers Example: <html> <head> <title>How to get the minimum value among two numbers in JavaScript</title> <script language="JavaScript"> <!– number1 = 23; numner2 = 34; document.write("The smallest number among these two numbers is " + Math.min(number1 , number2)); // … Continue reading How to get the minimum value among two numbers in JavaScript