Skip to content

Instantly share code, notes, and snippets.

@ross-u
Last active January 16, 2021 13:23
Show Gist options
  • Save ross-u/2e6fff85921c06839ba17cbb04e3a049 to your computer and use it in GitHub Desktop.
Save ross-u/2e6fff85921c06839ba17cbb04e3a049 to your computer and use it in GitHub Desktop.
JS | Objects - Objectively - Exercise
var joke = {
category: 'Chuck Norris Jokes',
url: 'https://api.chucknorris.io/jokes/I5_UU3f7Q2e2qao2TJz9aw',
content: 'Anything you can do, Chuck Norris does better.'
}
// Task 1
// Using `for..in`, `console.log` all property names of the `joke` object,
// concatenating string `joke.` first.
// Expected result : 'joke.category', `joke.url`, `joke.content`
// Task 2
// Using `Object.keys` get the array of property names (keys) from the object joke
// and `console.log` that array.
// Task 3
// Using keyword `delete`, remove the property `url` from the object joke.
// Task 4
// Using dot notation add method (function) `hint` to the joke object.
// Method should `console.log`: "The joke is stored in the property .content"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment