Home
<!DOCTYPE html> <html> <body> <h1>Demo: Anonymous Function as Callback</h1> <p id="p1"></p> <script> let numbers = [2, 3, 4, 5]; let squareNumbers = numbers.map(function(number) { return number * number; }); document.getElementById("p1").innerHTML = squareNumbers; </script> </body> </html>
Result: