javascript object creating

Posted by Md. Shohel Rana on Stack Overflow See other posts from Stack Overflow or by Md. Shohel Rana
Published on 2014-06-09T03:11:41Z Indexed on 2014/06/09 3:25 UTC
Read the original article Hit count: 141

Filed under:
|

I have a javascript object like this

 var student = function () {
     this.id = 1;
     this.Name = "Shohel";
     this.Roll = "04115407";
     this.Session = "03-04";
     this.Subject = "CSE";
 };

and i have a javascript array list like this

var students = [];

now i want to push student into students, this is shown below

students.push(new student())  //no prolem

students.push(new student[id = 3]) //Problem

here second line occurs exceptions, how can i push javascript object like as c# add list, which is representing second line? thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery