the cocoX code for javascript