Skip to content

Instantly share code, notes, and snippets.

@milkbread
Created June 17, 2013 13:40
Show Gist options
  • Save milkbread/5796944 to your computer and use it in GitHub Desktop.
Save milkbread/5796944 to your computer and use it in GitHub Desktop.
JavaScript: JS-objects a simple example
<script>
var body = d3.select('body');
var an_object = {key1:"value1", key2:"value2"}
body.append("text").text("1: ",an_object['key1'])
body.append("text").text("2: ",an_object.key1)
for (one_key in an_object){
body.append("text").text("3.1: ",one_key)
body.append("text").text("3.1: ",an_object[one_key])
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment