I’ll leave an example of JSON data below. I filter the names in this data using beginWith (“P”), but I just want the names beginning with “P” to appear and write that name to a DOM element. Below is the code I used but failed. You can take a look at my codepen account to see how my code works better. codepen: https://codepen.io/BerkayAkgurgen/pen/RwoKBrG
const dd = document.getElementById("deneme");
let dene = data.map(item =>item.name.startsWith("P"))
dd.innerHTML = dene
// DATA
let data = [{
_id: "5e652aa6baec2fe6fea7ed2c",
index: 0,
guid: "25743f49-50b9-417a-93c3-12bb3f80514c",
isActive: true,
balance: "$2,339.94",
picture: "http://placehold.it/32x32",
age: 37,
eyeColor: "blue",
name: "Pate Henry",
gender: "male",
},{
_id: "5e652aa69cb94a55a21dbd24",
index: 1,
guid: "7fbd5a0a-5d8b-4cdd-97b7-f7715183ea60",
isActive: true,
balance: "$3,929.51",
picture: "http://placehold.it/32x32",
age: 30,
eyeColor: "brown",
name: "Carole Daniels",
gender: "female",
}
]