javscript using array,clouse