Run ❯
zig
.
com
Result Size:
625 x 565
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Arrays</h2> <p>Compute a new array with the full name of each person in the old array:</p> <p id="demo"></p> <script> const persons = [ { firstname: "Malcom", lastname: "Reynolds" }, { firstname: "Kaylee", lastname: "Frye" }, { firstname: "Jayne", lastname: "Cobb" } ]; document.getElementById("demo").innerHTML = persons.map(getFullName); function getFullName(item) { return [item.firstname, item.lastname].join(" "); } </script> </body> <!-- /jsref/tryit.asp?filename=tryjsref_map3 </html>