区别:

[]表示是一个数组,如var strs = ['a','b','c']{}表示是一个对象,比如,
var obj = {
name: '宙斯',
sex: 1
}

如何在数组中删除指定对象呢??

[
    {
        "id": 12,
        "title": "fdsfsdds",
        "markdown": "fsdafafs",
        "counttet": "fsdafafs"
    },
    {
        "id": 13,
        "title": "fdsfsdds",
        "markdown": "fsdafafs",
        "counttet": "fsdafafs"
    },
    {
        "id": 14,
        "title": "fdsfsdds",
        "markdown": "fsdafafs",
        "counttet": "fsdafafs"
    },
    {
        "id": 16,
        "title": "fdsfsdds",
        "markdown": "fsdafafs",
        "counttet": "fsdafafs"
    },
   ]

方法: index可以是动态的,这样就能指定删除某一对象

splice(index,1)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案