Uncaught TypeError: data.push is not a function

前端 未结 8 1519
半阙折子戏
半阙折子戏 2020-12-04 23:45

I am trying to push

data.push({\"country\": \"IN\"});

as new id and value to a json string. but it gives the following error



        
8条回答
  •  长情又很酷
    2020-12-04 23:51

    make sure you push into an Array only and if their is error like Uncaught TypeError: data.push is not a function** then check for type of data you can do this by consol.log(data) hope this will help

提交回复
热议问题