Aller au contenu

Programmation JavaScript/Références/Objets/Number

Un livre de Wikilivres.
  • MAX_VALUE
plus grand nombre pouvant être sauvegardé
  • MIN_VALUE
plus petit nombre pouvant être sauvegardé
  • NaN
nombre non valable
  • NEGATIVE_INFINITY
nombre trop petit
  • POSITIVE_INFINITY
nombre trop grand
  • toExponential()
  • toFixed()
  • toPrecision()
  • toString()

Pour afficher arrondit un nombre formaté à la française :

let myAmountOfMoneyWithVat = document.querySelector('#myAmountOfMoneyWithVat').value.replace(/,/g, '.').replace(/ /g, '').replace(/[\s€]/g, '');
document.querySelector('#myAmountOfMoneyWithVat').value = myAmountOfMoneyWithVat.toFixed(2);