0

Please can you explain

Why alert(typeof(typeof(3.14))) will have output string? Why not a number? Thanks.

20th Feb 2020, 6:22 AM
Михаил
5 Answers
+ 7
because typeof 3.14 is "number" so typeof "number" is string please use appropriate question title and tags. https://www.sololearn.com/Discuss/1316935/?ref=app priya, you can highlight that star at lower left of question to follow a thread without answering 😉
20th Feb 2020, 6:29 AM
Gordon
Gordon - avatar
+ 2
alert(typeof(3.14)) // outputs number because 3.14 is a number alert(typeof(typeof(3.14))) //outputs string because "number" is a string alert(typeof(typeof(typeof(3.14)))) // outputs string because "string" is a string
20th Feb 2020, 6:30 AM
Fernando Pozzetti
Fernando Pozzetti - avatar
+ 1
Thank you all
20th Feb 2020, 6:31 AM
Михаил
0
Following
20th Feb 2020, 6:27 AM
Priya gupta
Priya gupta - avatar
0
Ok, got it. It gives answer to the word number... alert(typeof(typeof(3.14))) alert(typeof(number)) alert(string) 👍
20th Feb 2020, 6:31 AM
Priya gupta
Priya gupta - avatar