making generator for javascript