adding javascript implementation