Function Within Function In Javascript Mdn Array Js