Home>Article>Web Front-end> js object properties
There are two ways to access js object properties. This article will share with you the codes for these two ways. Friends who are interested can take a look.
var test={ name:'wzh', sex:'man' } var n='name'; console.log(test[n]);//第一种:可以动态访问对象属性 console.log(test.name);//第二种:不能动态访问对象属性
Related recommendations:
javascript - Is there only one way to modify the attribute name of a js object?
The above is the detailed content of js object properties. For more information, please follow other related articles on the PHP Chinese website!