diversions in javascript