Home  >  Article  >  Web Front-end  >  JavaScript dynamic access to JSon elements sample code_javascript skills

JavaScript dynamic access to JSon elements sample code_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:23:461012browse
Copy code The code is as follows:

$(document).ready(function () {

var obj = {Name: 'Allen', Age: '30'};
for (var o in obj)
{
var a = console.log(o); // Name , Age
var a = console.log(obj[o]); //Allen,30
}
});

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