Working example for conditional

Wrote JS to have example 1 be functional for conditionals.