I have a function that when the return statement is prefaced with typeof it says it's a number. But when I remove it it outputs NaN .
I don't understand why.
Here's a fiddle:
Thank you.
I modified your jsfiddle
You were using bookPrice
instead of this.price
Trying alert(typeof NaN)
might be illuminating.
Although NaN
literally means "not a number", it actually is a kind of number
. Its meaning is "not a valid number" (in the sense of mathematical numbers), but it is still a number
value (in the sense of Javascript types).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.