Console.log output in javascript

后端 未结 6 570
闹比i
闹比i 2021-01-01 01:22

Why do console.log(00); and console.log(01); print 0 & 1 in the browser console and not 00 & 01?

console.log(00); // prints         


        
6条回答
  •  暖寄归人
    2021-01-01 01:44

    When you write console.log(00), the argument 00 is interpreted as number and so 0 is printed. On the other hand if you write console.log("00") 00 is interpreted as a string and 00 is printed.

提交回复
热议问题