Ok, what you’re witnessing is a closure problem since you declared your variables using var. And since console.log is a function, it will only have access to the global romarr when the loop finishes.
Why codepen’s console is different is due to their code. I think they hijack the console rather than show the actual log.
I explained closures in this other response. Closures are a complicated topic, so if that answer doesn’t work for you, tell me what I didn’t make clear.