views:

28

answers:

1

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];
+1  A: 

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.

David Dorward