Javascript Number valueOf()

Introduction

The Javascript Number valueOf() method converts a Number object to its primitive value.

numObj.valueOf()

Using valueOf

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

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



PreviousNext

Related