Decision Making in JavaScript