Javascript exercise for course of IEEE