JavaScript Prototype Tip
So, prototype, what is it again?</br>
I've fiddeled around abit and created an easy self explanatory code segment to explain the nutorious prototype object:</br>
Check it out in http://jsbin.com/abemax/7/
If we were to add extra functions to the Name obejct,</br> we would have to use the prototype object inorder to do that. Otherwise we would get and error, because we can't attach a new function to an already "encapsulated" object (aka Name).
Written by Agam
Related protips
2 Responses
You created a global variable using only "char" in the for cycle. I think it should be "var char" instead.
over 1 year ago
·
Yep, my bad. Thanks
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Js
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#