Can someone help me understand why the string values entered in an html form are returning as a number when I use typeof
, even when the original value is very specifically a string?
Below is a link to a pic of two values input first as random text (yyy
) then as as a number (999
), followed by their "types" before and after passing the values through the Number()
function. Before they pass through the Number()
function both are strings, as expected.
However, after passing the intentional string (yyy
) through the Number()
function I expected that "if you pass in a string with random text in it, you’ll get NaN
, an acronym for 'Not a Number.' "
But, instead, it's saying that both (999
)'s and (yyy
)'s values are of the type "number"
.