Skip to content

Instantly share code, notes, and snippets.

@bnoden
Created March 22, 2016 00:23
Show Gist options
  • Save bnoden/78d3aa14c01c42a9d126 to your computer and use it in GitHub Desktop.
Save bnoden/78d3aa14c01c42a9d126 to your computer and use it in GitHub Desktop.
Arrays and Objects in JS
var object = [,,]
var object1 = {
id: "Metal Slime",
is: false
}
var object2 = new Object()
var object3 = {
id: "Putrid Moldyman"
}
object2.id = "Tonberry King"
object2['is'] = false
object3.is = true
object.push(object1)
object.push(object2)
object.push(object3)
for (var i in object)
if (object[i].is)
console.log(object[i].id + " is actively annoying!")
else console.log(object[i].id + " stopped moving!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment