Fix while loop issue that caused page to break

Howdy,

Saw you were using a "while" loop in the JS which was causing the example page to not render. Changed it to an if statement (like you have on the github style guide) and it started working again!

Best,
Brian