Fix if/else javascript example

One of the students emailed me with problems after trying out the js in this slide. Here's a potential fix. :)