1.向數組中添加json數據
var arr=[]; var json = {"name":"apple","color":"red"} arr.push(json) console.log(arr)
返回結果:
2.新增 json 鍵值對
var fruit =[{"name":"banana"}]; fruit[0].color='yellow' console.log(fruit)
返回結果:
var arr=[]; var json = {"name":"apple","color":"red"} arr.push(json) console.log(arr)
返回結果:
var fruit =[{"name":"banana"}]; fruit[0].color='yellow' console.log(fruit)
返回結果:
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。