[javascript] boolean in an if statement