Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Person(first,last){
- var first = '', last = '';
- this.getName = function(){
- return this.first + ' ' + this.last;
- }
- this.setName = function(first,last){
- this.first = first;
- this.last = last;
- }
- };
- var person = new Person('John','Smith');
- console.log(person);
- var obj = {
- first: '',
- last: '',
- getName: function(first,last){
- return first + ' ' + last;
- },
- setName: function(first,last){
- this.first = first;
- this.last = last;
- }
- }
- obj.setName('John','Smith');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement