Made a javascript version.