Presentation is loading. Please wait.

Presentation is loading. Please wait.

Math class Random() method Floor method Top-level parseInt function

Similar presentations


Presentation on theme: "Math class Random() method Floor method Top-level parseInt function"— Presentation transcript:

1 Math class Random() method Floor method Top-level parseInt function
JavaScript Math class Random() method Floor method Top-level parseInt function

2 Math Class Constants and Math Functions Constant Description
Actual value Math.E The base of the natural log system Math.LN10 Natural logarithm of 10 Math.PI Ratio of circle circumference to diameter Math.SQRT2 Square root of 2 Math.sqrt(x) Square root of x Math.pow(x, n) Returns x to the power of n Math.log(n) Returns the natural logarithm of n Math.exp(n) Returns e to the power of n

3 Rounding Functions and Random Numbers
Description 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Math.round(x) Rounds to the nearest integer Math.floor(x) Rounds down to the nearest integer Math.ceil(x) Rounds up to the nearest integer Math.random() Random value between 0 and <1 Math.min(a, b, c) Returns the lowest value from list Math.max(a, b, c) Returns the highest value from list

4 ParseInt function syntax: parseInt( 'string' [, base] )
Semantics: The first argument of parseInt must be a string. The second argument, optional, specifies the number base of the string. The base argument can be any integer from 2 to 36. The function converts a string into an integer. If there is only one argument, the number base is detected according to the general JavaScript syntax for numbers. Strings that begin with 0x or -0x are parsed as hexadecimals; strings that begin with 0 or -0 are parsed as octal numbers. All other strings are parsed as decimal numbers.


Download ppt "Math class Random() method Floor method Top-level parseInt function"

Similar presentations


Ads by Google