Code to draw in javascript