Skip to content

Instantly share code, notes, and snippets.

@becsegal
Created July 10, 2017 13:45
Show Gist options
  • Select an option

  • Save becsegal/54c40c1a82124af0b48ab4ca03722ffd to your computer and use it in GitHub Desktop.

Select an option

Save becsegal/54c40c1a82124af0b48ab4ca03722ffd to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=54c40c1a82124af0b48ab4ca03722ffd
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
{"hiddenUIComponents":["output"]}
var song = {
title: 'Here Comes the Sun',
artist: 'The Beatles',
cover_image: 'http://cdn.thebeatles.com/sites/default/files/tile/image/original_593.jpg',
spotify_url: 'https://open.spotify.com/track/6dGnYIeXmHdcikdzNNDMm2'
};
// 3 ways to access the cover image
console.log(song.cover_image);
console.log(song['cover_image']);
var key = 'cover_image';
console.log(song[key]);
// Get all the keys and values without knowing anything about the object
for (var key in song) {
console.log("key: " + key + ", " + song[key]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment