Created
March 22, 2016 01:02
-
-
Save bnoden/15577de3cba016220a8e to your computer and use it in GitHub Desktop.
Heterogeneous Arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Monster(id, name, cry, is){ | |
this.id = id | |
this.name = name | |
this.cry = cry | |
this.is = is | |
} | |
var putridMoldyMan = new Monster(231, "Putrid Moldyman", '"Bleh"', true) | |
var myArray = [putridMoldyMan.id, putridMoldyMan.is, putridMoldyMan.cry, putridMoldyMan] | |
console.log(myArray[3].name + " jumped out of the trashcan!") | |
var wannaFight = prompt(myArray[3].name + | |
" jumped out of the trashcan!\nWanna fight " + | |
myArray[3].name + "?\nY/N").toUpperCase() | |
if (wannaFight[0] == 'Y') | |
console.log(myArray[3].name + ':\n' + myArray[3].cry) | |
else console.log("Your ran back home to your mommy!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment