updating js for TODO #4