A simple async implementation of the "if" conditional construct in JavaScript