Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var Student;
var students;
var student1;
var student2;
var i, len, student;
Student = (function() {
function Student(fname, lname) {
this.firstName = fname;
this.lastName = lname;
}
return Student;
})();
students = [];
student1 = new Student('Paul', 'Jones');
student2 = new Student('Jane', 'Smith');
students.push(student1);
students.push(student2);
for (i = 0, len = students.length; i < len; i++) {
student = students[i];
document.write(student.firstName + ' ' + student.lastName + '<br>');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.