javaScript nested for-in and for loops