2

How can I distinguish between a string and number when logging to the console with Chrome Dev Tools?

Image from another post

this answer to "Blue number in Chrome Dev Console?" has a screenshot of what happens when you pass a string to console.log and what happens when you pass a number.

I can make out a difference in colour when it's blown up this large, but have difficulty when it is its usual size.

By contrast, in Ruby, distinguishing between an Integer object and a String object is easy - doing puts foo.inspect will give you quotation marks around a string, but not around the integer.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338

0 Answers0