implemented JS features for hw2