JavaScrip implementation of the Cartesian coordinate system