Under Data-types in JavaScript... | Sololearn: Learn to code for FREE!

+1

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?

10/4/2017 2:04:50 AM

Michael

5 Answers

New Answer

+2

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!

+1

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.

0

Hello guys can anyone pls tell me how to bypass capchas

0

Hi please I need a coach

-2

Hello guys can anyone tell me how to get links from js