简体   繁体   中英

Node.js: Call properties with dashes (-)

I want to call a property which has a dash (message-id).

msg.message-id is not the solution because it is seen as 2 different words. How do I call 'message-id'?

Thanks

msg["message-id"]

您可以使用数组访问符号(但使用字符串而不是整数)访问属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM