Skip to content

Instantly share code, notes, and snippets.

@iamkevinlowe
Created May 5, 2021 19:24
Show Gist options
  • Save iamkevinlowe/bcd1c3ffc090b81ef441ed41b961706d to your computer and use it in GitHub Desktop.
Save iamkevinlowe/bcd1c3ffc090b81ef441ed41b961706d to your computer and use it in GitHub Desktop.
/* Protect the networkDefinitions object so that it is not mutable */
const networkDefinitions = {
gmb: {
name: 'Google My Business'
},
bbb: {
name: 'Better Business Bureau'
}
};
// Write your code here
// End
networkDefinitions.foo = { name: 'Bar' };
networkDefinitions.gmb.name = 'GMB';
console.clear();
console.log('Running assertions');
console.assert(!networkDefinitions.hasOwnProperty('foo'), "networkDefinitions shouldn't contain foo");
console.assert(networkDefinitions.gmb.name === 'Google My Business', "gmb name should be Google My Business");
console.log('Finished assertions');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment