merged tasks in javascript