Last Updated: February 25, 2016
·
693
· agam360

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).

2 Responses
Add your response

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 ·