Why Register With OSV?

Join 5700+ of your peers

Get enriched. Access 1270+ quality tutorials right away on:

  • Joomla 2.5.X, 3.0.X
  • WordPress 3.5.X
  • Shopping Carts
  • E-Commerce Payment Gateways
  • PDFs for each tutorial - FREE for download
  • New topics and tutorials added weekly

FREE EBooks

FREE Templates

Member Login

Not a member yet? Sign Up!

Opensourcevarsity Logo
Tutorials & Training from experienced world class trainers
Welcome, Guest
Username Password: Remember me

what's prototypes for JavaScript?
(1 viewing) (1) Guest
All your queries regarding JavaScript will be solved in this forum
  • Page:
  • 1

TOPIC: what's prototypes for JavaScript?

what's prototypes for JavaScript? 9 months, 4 weeks ago #1354

  • sagar
  • OFFLINE
  • Senior Boarder
  • Posts: 48
  • Karma: 0
Can anyuone tell me what's prototypes for JavaScript?

Re: what's prototypes for JavaScript? 9 months, 4 weeks ago #1363

  • gaurang
  • OFFLINE
  • Junior Boarder
  • Posts: 38
  • Karma: 0
"Objects have ""prototypes"" from which they may inherit fields and functions.

<s-cript type=""text/j-avascript"">
function movieToString() {
return(""title: ""+this.title+"" director: ""+this.director);
}
function movie(title, director) {
this.title = title;
this.director = director || ""unknown""; //if null assign to ""unknown""
this.toString = movieToString; //assign function to this method pointer
}
movie.prototype.isComedy = false; //add a field to the movie's prototype
var officeSpace = new movie(""OfficeSpace"");
var narnia = new movie(""Narni"",""Andrew Adamson"");
document.write(narnia.toString());
document.write(""
Narnia a comedy? ""+narnia.isComedy);
officeSpace.isComedy = true; //override the default just for this object
document.write(""
Office Space a comedy? ""+officeSpace.isComedy);
</script>

"
  • Page:
  • 1
Time to create page: 1.14 seconds
O-S-V Free Templates

FREE HTML / Joomla / WordPress Templates For Download
Registration Required

CONNECT WITH US

Sitemap   |   Privacy Policy   |   MySQL(70)   |   Disclaimer   |   Reach Out To Us
Designed by Ivan Bayross & Meher Bala | Powered by Joomla
© 2013 All Rights Reserved.