Learn JavaScript Syntax Introduction, Why is 20.49 not a string?

Hi there,

A string is defined as characters on keyboard surrounded by a quote. How come the instruction number 4 is not surrounded by parenthesis ? 20.49 comprises numbers and dot sign(.), so I expect it to be a string


Just to make sure we are talking about the same thing, you are referring to step 4/10 “Data Types” where it says:

Data types are the classifications we give to the different kinds of data that we use in >programming. In JavaScript, there are seven fundamental data types:

  • Number : Any number, including numbers with decimals: 4 , 8 , 1516 , 23.42 .
  • String : Any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) >surrounded by single quotes: ' ... ' or double quotes " ... " . Though we prefer single quotes. Some >people like to think of string as a fancy word for text.

correct? In the United States numbers with decimal parts are represented with a dot .
I know that in other countries is common to use a comma , instead. So a number like 23.42 is a valid number, with an integer part (23) and a decimal part (42).

Please feel free to keep asking questions, it can be confusing!