added js functional pattern example