Javascript 如何在ts中为数组中的对象动态设置值
你错过了一个[我] 让我们=[ {'firstName':iroman, 'lastName':k}, {'firstName':蚂蚁, “lastName”:k} ] 设b=[] 让co=[] forlet i=0;i你应该使用:Javascript 如何在ts中为数组中的对象动态设置值,javascript,Javascript,你错过了一个[我] 让我们=[ {'firstName':iroman, 'lastName':k}, {'firstName':蚂蚁, “lastName”:k} ] 设b=[] 让co=[] forlet i=0;i你应该使用: [{"firstName":"hulk","lastName":"k"},{"firstName":"hulk","lastName&
[{"firstName":"hulk","lastName":"k"},{"firstName":"hulk","lastName":"k"}]
Actual output-
[{"firstName":"iroman","lastName":"k"},{"firstName":"antman","lastName":"k"}]:
你应该做[i]['firstname']
[{"firstName":"hulk","lastName":"k"},{"firstName":"hulk","lastName":"k"}]
Actual output-
[{"firstName":"iroman","lastName":"k"},{"firstName":"antman","lastName":"k"}]:
a[i]['firstName']='hulk';