Micah Micah - 15 days ago 4x
Javascript Question

What does ':' (colon) do in JavaScript?

I'm learning JavaScript and while browsing through the jQuery library I see

(colon) being used a lot. What is this used for in JavaScript?

// Return an array of filtered elements (r)
// and the modified expression string (t)
return { r: r, t: t };

var o = {
    r: 'some value',
    t: 'some other value'

is functionally equivalent to

var o = new Object();
o.r = 'some value';
o.t = 'some other value';