Demonstrating the valueOf() method : valueOf « Number Data Type « JavaScript Tutorial






<html>
<head>
<title>Demonstrating the valueOf() method</title>
<script type="text/javascript" language="javascript">
<!-- //
function DisplayValue(){
    var entry1 ;
    entry1 = prompt("Enter a floating point number", "123.123");
    var number = new Number();
    number = Number(entry1);
    if (isNaN(number)){
        document.write("<P>You did not enter a valid number.<br />");
    }
    else{
        document.write(number.valueOf() + "</p>");
    }
}
// -->
</script>
</head>
<body onload="DisplayValue()">
<P>This listing demonstrates the use of the valueOf() method.</p><br />
</body>
</html>








5.10.valueOf
5.10.1.Number.valueOf()
5.10.2.Demonstrating the valueOf() method