我正在尝试使用 js 从数组中删除某些项目
这是我的数组
[
{
"Pizza": "Margarita",
"Size": "Twelve Inch Stuffed Crust",
"Base": "Deep Base",
"Price": "6.50"
},
{
"Pizza": "Hot Vegetarian",
"Size": "Twelve Inch",
"Base": "Deep Base",
"Price": "6.00"
},
{
"Pizza": "Vegetarian",
"Size": "Ten Inch Stuffed Crust",
"Base": "Deep Base",
"Pricelabel": "Price",
"Price": "6.50"
},
{
"Pizza": "Hot Vegetarian",
"Size": "Fourteen Inch Stuffed Crust",
"Base": "Deep Base",
"Pricelabel": "Price",
"Price": "10.50"
}
]
在我的屏幕上,我有 4 个删除按钮,名为“deletebutton_0,deletebutton_1,deletebutton_2,deletebutton_4
因此,例如,如果我单击 deletebutton_0,js 将从数组中删除第一个项目的所有详细信息,
{"Pizza":"Margarita","Size":"Twelve Inch Stuffed Crust","Base":"Deep Base","Price":"6.50"}
我是js的菜鸟,还在学习。