Hi guys,
I have a doubt in this lesson of variables of yours.I am a newbie so pls, do understand me.
In this example what is the difference between this var = "50,000"
and this
var = 50,000
and why is the latter an error.
Is it that commas are only allowed in a string when declaring it.
Can you post a link to your exercise so we can have a look?
In your case, I think you’ve been missing a variable name?
var ???= “50,000”;
Let’s say you have given it a name:
var myLuckyNumber = "50,000";
The “50,000” is a string value. Just like a text, it does not contain numerical value.
BUT
if you write it this way:
var myLuckyNumber = 50000;
The 50000 is a number type data. It contains numerical value. You can have mathematical operation with it. Just don’t put comma in between, just numbers, simply because commas aren’t numbers.
Hi @codexthon ,
This doubt just popped of from my mind so, i couldn’t give you the exact part of the lesson.But thanks for your quick response and for making me understand.
Thanks