这是我的回复:
{ artist:
{ '#text': 'Sam Smith',
mbid: '5a85c140-dcf9-4dd2-b2c8-aff0471549f3' },
song: 'Stay with Me',
from:
{ '#text': 'In the Lonely Hour',
mbid: 'f43d20c0-2fa5-4bc2-9c42-c677e346e768' } }
现在我想选择艺术家姓名(“#text”),但如何选择以#开头的属性?
最佳答案
您可以使用bracket notation ,像这样
console.log(data.artist['#text'])
关于javascript - NodeJS/Javascript 选择一个以 # 开头的对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27865067/