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

Pubblicato il: 28 ottobre 2022
sul canale di: 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.


In questa pagina del sito puoi guardare il video online Number Methods - JavaScript Tutorial - w3Schools - Chapter 21 - English della durata di ore minuti seconda in buona qualità , che l'utente ha caricato w3Schools Tutorials 28 ottobre 2022, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 395 volte e gli è piaciuto 6 spettatori. Buona visione!