another set of problems to solve using js functions