Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function TheObject(first, last) {
- this.first = first;
- this.last = last;
- }
- TheObject.prototype.theMethod = function() {
- document.write("first : " + this.first + ", last : " + this.last + "</br>");
- };
- var anObject = new TheObject("Google", "Good");
- anObject.theMethod();
- var TheAnotherObject = function(first, last){
- return {
- first : first,
- last : last,
- theMethod : function() {
- document.write("first : " + this.first + ", last : " + this.last + "</br>");
- }
- };
- }
- var anotherObject = TheAnotherObject("Yahoo", "Good");
- anotherObject.theMethod();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement