Update task-2.html

add hasOwnProperty check