The classic way of doing this is as follows:
for(var i = 0; i < nameArray.length; i++){
var str = nameArray[i];
}
This will give you the exact functionality of a "foreach" loop, which I suspect is what you're really after here.
This also gives you the added benefit of working in Internet Explorer.
There is also extensive knowledge of the exact loop described in the MDN. At this time Android web and it seems not everything supports your method so check the compatibility list on that page; seems to be a future release of the new JavaScript that will probably have OOP inside it.