Under Data-types in JavaScript... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Under Data-types in JavaScript...

...specifically in Floating Point Numbers, the Try It Yourself part has a Variable called price, with the value being 55.55, so just for kicks and grins, I decided to put a $ in front of it because it said it was allowed. It said that in naming the variables, you could use a letter,_an_underscore_, or a $ dollar $ign. I am sure you can already tell that I am going to say it didn't work. And it didn't work. Why? What happened?

4th Oct 2017, 2:04 AM
Michael
Michael - avatar
6 Answers
+ 1
You mean you tried to name a variable $55.55? That almost works, but dots can't be part of a variable name. So javascript saw $55 and .55 after it and got confused!
4th Oct 2017, 2:22 AM
Schindlabua
Schindlabua - avatar
0
the variable can have a dollar sign in front. so $price=55.55 would have been fine. but the value assigned to the variable can't have the dollar sign unless you make it a string type.
4th Oct 2017, 3:04 AM
Mark McGhee
Mark McGhee - avatar
0
Hello guys can anyone pls tell me how to bypass capchas
21st Sep 2019, 9:30 AM
Jatin
0
Hi please I need a coach
27th Feb 2020, 7:28 PM
mohammed adeoye
0
Hi 👋 I need a coach
30th Nov 2021, 6:17 PM
Nganele Lyonga
- 2
Hello guys can anyone tell me how to get links from js
21st Sep 2019, 9:30 AM
Jatin