Eval() = Unexpected token : error

前端 未结 8 1823
囚心锁ツ
囚心锁ツ 2020-12-09 04:28

I tried this simple JavaScript code:

eval(\'{\"Topics\":[\"toto\",\"tata\",\"titi\"]}\')

In the Chrome console, for example, this returns

8条回答
  •  清歌不尽
    2020-12-09 04:46

    if you want to make an array use the below code

    var jsonObject = eval('(' +"["+ response + "]"+')');
    

提交回复
热议问题