Number Methods - JavaScript Tutorial - w3Schools - Chapter 21 - English

Publicado em: 28 Outubro 2022
no canal de: w3Schools Tutorials
395
6

These number methods can be used on all JavaScript numbers:

Method Description
toString() Returns a number as a string
toExponetial() Returns a number written in exponential notation
toFixed() Returns a number written with a number of decimals
toPrecision() Returns a number written with a specified length
ValueOf() Returns a number as a number

Number() Returns a number converted from its argument.
parseFloat() Parses its argument and returns a floating point number
parseInt() Parses its argument and returns a whole number


Number Object Methods
These object methods belong to the Number object:

Method Description
Number.isInteger() Returns true if the argument is an integer
Number.isSafeInteger() Returns true if the argument is a safe integer
Number.parseFloat() Converts a string to a number
Number.parseInt() Converts a string to a whole number
Number Methods Cannot be Used on Variables

The number methods above belong to the JavaScript Number Object.

These methods can only be accessed like Number.isInteger().

Using X.isInteger() where X is a variable, will result in an error:

TypeError X.isInteger is not a function.


Nesta página do site você pode assistir ao vídeo on-line Number Methods - JavaScript Tutorial - w3Schools - Chapter 21 - English duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário w3Schools Tutorials 28 Outubro 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 395 vezes e gostou 6 espectadores. Boa visualização!