Home >
Article > Web Front-end > How to dynamically add properties and values to objects using JS
How to dynamically add properties and values to objects using JS
高洛峰Original
2016-12-09 14:25:002661browse
As shown below:
var obj={};
for(var i=0;i<10;i++){
eval("obj.p"+i+"="+i);
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn