functional javascript workout