Mega Code Archive

 
Categories / JavaScript DHTML / Language Basics
 

Use function as the object constructor

<head> <title></title> </script> </head> <body> <script type = "text/javascript" > function Song(artist,length,title) {     this.artist = artist;     this.length = length;     this.title = title; } song1 = new Song("A","3:30","title"); </script> <p>Songs</p> </body>