Quotes help make search much faster. Example: "Practice Makes Perfect"

Friday, December 7, 2012

Codecademy Codeyear Looping


//sample solution


//This is an associative array of the results of the student roll call.
//If the value of the key is false, then the student was absent.
var students = {"robert":false,"joe":true,"sharon":true};

//Loop over the students associative array. If the student was present
//output their name to the console
for (var name in students){
if(students[name]){
console.log(name);
}
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts