Skip to content

Instantly share code, notes, and snippets.

@goodbedford
Last active November 12, 2015 07:45
Show Gist options
  • Save goodbedford/ab8a2461ca6600f5e9fb to your computer and use it in GitHub Desktop.
Save goodbedford/ab8a2461ca6600f5e9fb to your computer and use it in GitHub Desktop.
// what will Loretta wear?
// she will wear shirt and pants but if the temp is higher than 70 she will wear her shorts and short sleeve shirt.
// write the inner code for the whatToWear function.
// example answer: outfit //[ 'shorts', 'shoes']
function whatToWear( temp ) {
var clothes = ['shorts', 'short sleeve', 'pants', 'shirt', 'coat'];
var outfit =[];
if (temp >= 70) {
//shorts, short sleeve
outfit.push(clothes[0], clothes[1]);
} else if( temp < 70 && temp >= 55) {
//pants, shirt
outfit.push(clothes[2], clothes[3]);
} else if( temp < 55) {
//pants, coat
outfit.push(clothes[2], clothes[4])
} else {
console.log("Error, john must sleep in.")
}
//do not change
console.log("Loretta will wear ")
return outfit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment