Back

numObj.valueOf()

numObj.valueOf()

The valueOf() method returns the wrapped primitive value of a Number object.

Syntax

numObj.valueOf()

Parameters

None.

Description

This method is usually called internally by JavaScript and not explicitly in web code.

Examples

Using valueOf

var numObj = new Number(10);
console.log(typeof numObj); // object

var num = numObj.valueOf();
console.log(num);           // 10
console.log(typeof num);    // number

  Created by Mozilla Contributors, license: CC-BY-SA 2.5