+ 1

Strings Operator

In the course of Js on String Opeartor they said: Numbers in quotes are treated as strings: "42" is not the number 42, it is a string that includes two characters, 4 and 2. But if you write console.log("42") it outputs 42 ...Not a string Or What am i not Understand??

15th Aug 2020, 2:17 PM
Edmund Tcarters
3 Respuestas
+ 12
The only problem here is that console.log function logs given parameter without " symbols surrounding. But if you log to console: typeof "42" you should get string.
15th Aug 2020, 2:38 PM
Dominik Vladař
Dominik Vladař - avatar
+ 2
Okay , thks u guys ... I appreciate it
16th Aug 2020, 7:26 AM
Edmund Tcarters
+ 1
Check this code for understand it... var st = "43"; var n = 43 console.log(st) console.log(typeof(st)); console.log(n) console.log(typeof(n));
15th Aug 2020, 2:46 PM
Jayakrishna 🇮🇳