Created
February 5, 2012 18:25
-
-
Save phaedryx/1747038 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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