Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Javascript Articles - Page 486 of 671
131 Views
The trunc() function of the Math object accepts a number and returns its integral point (excluding the fractional part). If the given number itself is an integer this function returns the same.SyntaxIts Syntax is as followsMath.trunc();Example Live Demo JavaScript Example var result = Math.trunc(58.745); document.write("Integral part of the given number: "+result); OutputIntegral part of the given number: 58
115 Views
The sqrt() function of the Math object accepts a number and returns the square root value of the given number.SyntaxIts Syntax is as followsMath.sqrt();Example Live Demo JavaScript Example var result = Math.sqrt(169); document.write("Square root value of the given number: "+result); OutputSquare root value of the given number: 13
117 Views
The sign() function of the Math object accepts an integer number and returns its sign.(positive, negative)If the given number is a positive integer then, this function returns +1.And, if the given number is a negative integer then, this function returns -1.SyntaxIts Syntax is as followsMath.sign();Example Live Demo JavaScript Example var result = Math.sign(-128); document.write("Result: "+result); OutputResult: -1
160 Views
The round() function of the Math object accepts a floating point random number and returns its nearest integer value.If the given number is x.5 or more this function returns the next number (x+1)If the given number is x.4 or less this function returns the previous number (x-1).If the given number itself is an integer this function returns the same.SyntaxIts Syntax is as followsMath.round();Example Live Demo JavaScript Example var result = Math.round(2541.542); document.write("Rounded value of the given number: "+result); OutputRounded value of the given number: 2542
82 Views
The log2() function of the Math object accepts a number and returns the natural logarithm (base 2) of the given number.SyntaxIts Syntax is as followsMath.log2(48);Example Live Demo JavaScript Example var result = Math.log2(48); document.write("Result: "+result); OutputResult: 5.584962500721156
93 Views
The log1p() function of the Math object accepts a number and returns the natural logarithm (base E) of the (given number+1).SyntaxIts Syntax is as followsMath.log1p(48);Example Live Demo JavaScript Example var result = Math.log1p(48); document.write("Result: "+result); OutputResult: 3.8918202981106265
151 Views
The log10() function of the Math object accepts a number and returns the natural logarithm (base 10) of the given number.SyntaxIts Syntax is as followsMath.log10(48);Example Live Demo JavaScript Example var result = Math.log10(48); document.write("Result: "+result); OutputResult: 1.6812412373755872
115 Views
The imul() function of the Math object accepts two numbers and returns the result of C-like 32-bit multiplication of the given numbers.SyntaxIts Syntax is as followsMath.imul(47, 56);Example Live Demo JavaScript Example var result = Math.imul(47, 56); document.write("Result: "+result); OutputResult: 2632
177 Views
The hypot() function of the Math object accepts numbers and returns the square root of the sum of squares of the given numbers.SyntaxIts Syntax is as followsMath.hypot(12, 58, 66);Example Live Demo JavaScript Example var result = Math.hypot(12, 58, 66); document.write("hypot value: "+result); Outputhypot value: 88.67919710958147
250 Views
The fround() function of the Math object accepts a floating point number and returns the nearest 32-bit single precision float representation of a Number. If the given number itself is an integer this function returns the same.SyntaxIts Syntax is as followsMath.fround(160.98)Example Live Demo JavaScript Example var result = Math.fround(160.98); document.write("Fround value: "+result); OutputFround value: 160.97999572753906