Oracle Interview Question

it was a coding question using javascript