Javascript examples for Object:Constructor
Create an object constructor
<html> <head></head> <body> <p id="result"> <script type="text/javascript"> function student(name,id,level,phone){ this.name= name;/*from www . j a va2 s .co m*/ this.id= id; this.level= level; this.phone= phone; } function myFunction(){ var stud = new student("test","123_234_1353","three",0123456789); var name= stud.name; var id= stud.id; var level= stud.level; var phone= stud.phone; document.write(name); document.write(id); document.write(phone); } myFunction(); </script> </p> </body> </html>