Skip to content

Commit

Permalink
no doors
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrencelink committed Apr 24, 2013
1 parent 6f9e6a6 commit b8b2409
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
37 changes: 2 additions & 35 deletions homework-13.1-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,7 @@

hallway: {

doors: [0,0,0,0,0,0,0,0,0,0],

toggle: function ( door) {

if (door === 0) {
return 1;
}
if (door === 1) {
return 0;
}

},

pass: function( walk) {

this.doors = this.doors.map( this.toggle);


for (var i = 0; i < this.doors.length; i+=2) {

this.doors[i] = this.toggle( this.doors[i]);
}

if (walk === 2) {
for (var i2 = 0; i2 < this.doors.length; i2+=3) {

this.doors[i2] = this.toggle( this.doors[i2]);
}
}

return this.doors;

}

}

}

};
2 changes: 1 addition & 1 deletion homework-13.1-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ assert( hundredDoors.hallway);

// test: do we have Doors in our Hallway?


assert( hundredDoors.hallway.doors);

// test: do we have 10 Doors?

Expand Down

0 comments on commit b8b2409

Please sign in to comment.