defining a variable x? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

defining a variable x?

var x : 10; // correct or wrong I saw people using colon which confused me online

22nd Jun 2016, 6:00 PM
Hesham Ismail Ismail
Hesham Ismail Ismail - avatar
11 Answers
+ 5
var x = 10; //Correct. The colon is used in Object constructing using literal notation. key: value pairs.
22nd Jun 2016, 6:21 PM
ZinC
ZinC - avatar
+ 1
var x = 10; this way :)
1st Jul 2016, 4:49 AM
cesar calderon
cesar calderon - avatar
+ 1
var x = 10; this way :)
1st Jul 2016, 4:49 AM
cesar calderon
cesar calderon - avatar
0
u right
3rd Jul 2016, 7:26 AM
Amir Hossein
Amir Hossein - avatar
0
x=10
3rd Jul 2016, 7:35 AM
Ashley
0
I think x=10 but not sure
3rd Jul 2016, 7:36 AM
Ashley
0
Can I get a your wrong or your right ?
3rd Jul 2016, 7:36 AM
Ashley
0
var x;
13th Aug 2016, 5:59 PM
Mayank Mani Tripathi
Mayank Mani Tripathi - avatar
0
If you are changing line after "var x" then ";" is not needed but using ";" is considered good practice in programing.
13th Aug 2016, 6:01 PM
Mayank Mani Tripathi
Mayank Mani Tripathi - avatar
- 1
so x=10?
26th Jun 2016, 5:39 PM
Ashley
- 1
is this Roman
3rd Jul 2016, 7:37 AM
Ashley