Skip to content

Instantly share code, notes, and snippets.

@jamessergeant
Created August 9, 2017 13:30
Show Gist options
  • Save jamessergeant/6b1e541670791ffe432bfa12bffc46b4 to your computer and use it in GitHub Desktop.
Save jamessergeant/6b1e541670791ffe432bfa12bffc46b4 to your computer and use it in GitHub Desktop.
function createMyObject() {
var obj = {
foo: 'bar',
answerToUniverse: 42,
'olly olly': 'oxen free',
sayHello: function() {
return 'hello';
}
}
return obj
}
function updateObject(obj) {
obj.foo = 'foo';
obj.bar = 'bar';
obj.bizz = 'bizz';
obj.bang = 'bang';
return obj
}
function personMaker() {
var person = {
firstName: 'Paul',
lastName: 'Jones',
// replace `null` with a function that uses self reference to return
// full name
fullName: function() {return this.firstName + ' ' + this.lastName}
};
return person;
}
function keyDeleter(obj) {
delete obj.foo;
delete obj.bar;
return obj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment