Updated empty function to check for empty arrays.
Changed isset to pass arguments to console.log
Wrapped the whole definition within the file in a closure.