basic javascript implementation complete