rewritting project undermine in javascript