Javascript foreach() <p id=”demo”></p> <script> const numbers = [65, 44, 12, 4]; numbers.forEach(myFunction) document.getElementById(“demo”).innerHTML = numbers; function myFunction(item, index, arr) { arr[index] = item * 10; } </script> </body> Cook with me Share this content Opens in a new window X Opens in a new window Facebook Opens in a new window WhatsApp You Might Also Like Copy text on click javascript April 15, 2024 Display Image Before Uploading July 12, 2023 async await fetch api in js September 23, 2023 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.