Branch when possible: When performance matters, itâ€™s often advisable to branch out your functions in a way that ensures processor-intensive or memory-hungry tasks wonâ€™t be frequently repeated. One of the most common scenarios where this situation can arise is handling browser differences

Make Flags: var w3 = !!(document.getElementById && document.createElement); The not operators (!!) simply perform a Boolean conversion. The first operator changes the type of the object on the right to a Boolean, and then the second will just reverse whatever the first returned