updated js for in-class assignment