JavaScript Number Object

Number Object Properties

  • MAX_VALUE - The largest value that may be used in JavaScript.
    if (Math.exp(value1)<= Number.MAX_VALUE)
       exponenta(value1)
    else
       exponentb(value1)
    
  • MIN_VALUE - The smallest value that may be used in JavaScript.
  • NaN - Used to indicate a value is not a number. A number object may be set to this value to indicate that it is not really a number.
    if (Month < 1 || Month > 12) {
       Month = Number.NaN
    }
    
  • NEGATIVE_INFINITY - The value returned if a negative overflow occurs. Any numeric value divided by this is 0.
  • POSITIVE_INFINITY - The value returned if a positive value overflow occurs. Any numeric value divided by this is 0.
  • prototype - For creating more properties.

Number Object Methods

The number object must have an instance created in order to use it. The number object has no specific functions. Built in functions that are associated with numbers include:

  • eval() - A powerful function that evaluates string expressions. The example below returns "26".
    var str = "6 + 20"
    document.write(eval(str))
    
  • isNaN()
  • parseFloat() - Used to convert a string to an floating point value. The example will return a value of 212.3.

    var value1 = parseInt("212.3")

  • parseInt() - Used to convert a string to an integer value. The example will return a value of 212.

    var value1 = parseInt("212.3")

  • toString()
  • valueOf()

The Boolean Object

This object is used to turn a value that is not boolean into a value that is boolean which is true or false.

objectName = new Boolean(startingValue)

The only property of boolean is prototype which is used to create more properties.

JavaScript Manual Contents Page