Avatar ·

How to iterate over all array elements in JavaScript? Loops, forEach and modern methods

Hello everyone! I just started learning JavaScript and ran into a problem. I have an array with user names: ```javascript let users = ["Anna", "Ivan", "Maria", "Petr"]; ``` I need to output each name to the console or do something else with them. I tried writing `console.log(users)`, but it outputs the entire array at once, not each element individually. How do I properly iterate over each element of the array? I've heard about loops, but I don't understand which one is better to use. I've seen examples with `for`, `while`, and some strange `forEach`. I also hear about methods like `map` and `filter`, but those aren't loops at all, they're something else. I need a simple and clear explanation: how to iterate over an array and do something with each of its elements? Preferably with code examples so I can try them right away in the console.