Last active
August 18, 2017 19:29
-
-
Save jnf/56201e83a478497f7a975f95035b6a79 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var answers = [ | |
"Yes", | |
"No", | |
"It was the tofu", | |
"Call your mom", | |
"IDK" | |
]; | |
function shakeEightBall () { | |
var rando = Math.floor(Math.random() * 5); | |
var fortune = answers[rando]; | |
if (fortune) { | |
console.log(fortune); | |
} else { | |
console.log("Ask again"); | |
} | |
} |
This file contains hidden or 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
var cart1 = [ | |
{ name: "fanciest jacket", price: 17.99 }, | |
{ name: "not so fancy coat", price: 5.99 }, | |
{ name: "golden tap shoes", price: 59.85 }, | |
{ name: "doggles (google it)", price: 17.44 }, | |
{ nane: "+2 argyle socks of cunning", price: 31.99 } | |
]; | |
var cart2 = [ | |
{ name: "lonely glove", price: 0.01 } | |
]; | |
function total (list) { | |
} |
This file contains hidden or 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
console.log('I am loops!'); | |
var album = { | |
artist: "Prince", | |
title: "Purple Rain", | |
"best song": "When Doves Cry", | |
label: "Warner Bros." | |
}; | |
for (var key in album) { | |
var value = album[key]; | |
console.log("The album's " + key + " is " + value); | |
} | |
// var birthday = { | |
// day: 26, | |
// month: 2, | |
// year: 1980 | |
// } | |
// | |
// for (var key in birthday) { | |
// var value = birthday[key]; | |
// console.log(key + ": " + value); | |
// } | |
// | |
// var lyrics = [ | |
// "just a city boy", | |
// "born and raised in south detroit", | |
// "took the midnight train", | |
// "going annnyyyywheeeerrreeeeee" | |
// ]; | |
// | |
// for (var i = 0; i < lyrics.length; i++) { | |
// console.log(lyrics[i]); | |
// } | |
// var birthday = [26, 2, 1980]; | |
// var months = [ | |
// "Jan.", "Feb.", "March", "Apr.", "May", | |
// "June", "July", "Aug.", "Sept.", "Oct.", "Nov.", "Dec." | |
// ]; | |
// | |
// var output = ""; | |
// for (var i = 0; i < birthday.length; i++) { | |
// output = output + birthday[i] + ' '; | |
// } | |
// console.log(output); | |
// "26 February 1980" | |
// for (var num = 100; num >= 20; num = num - 20) { | |
// console.log(num); | |
// } |
This file contains hidden or 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
var int = 99; | |
function addItUp(paramNum) { | |
paramNum = paramNum + 12; | |
console.log("Output is " + paramNum); | |
} | |
addItUp(int); | |
console.log(int); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment