Converting string array to Name/Value object in javascript

后端 未结 4 1583
甜味超标
甜味超标 2020-12-11 09:10

I currently am dealing with a Web Service that is returning an array of strings to the client. From here I would like to take this array of strings and convert it into an o

4条回答
  •  囚心锁ツ
    2020-12-11 09:46

    I don't think jQuery has to be used here.

    var result = ["test", "hello", "goodbye"];
    var final = [];
    for(var i = 0; i < result.length; i++) {
        final.push({value: result[i]})
    }
    

提交回复
热议问题