Completed task: Write JS functions