Ashish Rajan
Ashish Rajan

Reputation: 1200

Javascript object declaration help

I have defined objects in js as following

 var newevent = {title: txt, start: new Date(y, m, d, h, mi), end: new Date(y, m, d, h, mi+parseInt(eventtime[itemobj])), allDay: false, editable:eventedit[itemobj], className:eventbg[itemobj]};

My question is, what sense does the following code make?

var evt = [newevent];

Upvotes: 0

Views: 909

Answers (1)

Quentin
Quentin

Reputation: 943214

It creates a variable (locally scoped to the function) called 'evt' and assigns an array to it. That array has length 1 and contains a reference to the object assigned to newevent.

As to what sense it makes — none without any context. We don't know why the author thinks it is useful to put it in an array.

Upvotes: 1

Related Questions