Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typeof yourFunction === 'function'
- typeof String.link === 'function' // false
- typeof String.link() === 'function' // Uncaught error ...
- typeof String.prototype.link === 'function' //true
- function foo(){
- alert('from foo');
- }
- foo.bar = function(){
- alert('bar on foo');
- }
- foo(); //from foo
- foo.bar(); //bar on foo
- String//Defines the Object
- String.prototype//Defines the methods and properties that will be bound to a var of the type String
- 'foo'//This is a string
- 'foo'.link//So it has the link method
- String//This is an Objecy that defines the strings
- String.link//So it doesn't have the link method
- String.prototype//An object that stores the methods and properties of the vars of type String
- String.prototype.link//So it has the link method
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement