Very simple question but I'm quite new to JS and this is not easy to search.
If I see a line like this:
var colours = {}, r, g, b;
I get that it's just a declaration for 3 vars, but what does the {} bit mean? I can't see anywhere that gives me an idea as to what this is declaring?
Thanks!
It declares new object and equivalent to new Object();
var colours = {}, r, g, b;
This declares 4 variables which is the same as
var colors = {}; // this is an empty object like, var colors = new Object();
var r; // undefined
var g; // undefined
var b; // undefined
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With