Inflearn Community Q&A
[정리시간] 해보았습니다!
Written on
·
173
0
'use strict'
var member = {
jan: {
item:{
title: "JS북",
amount: 100
},
point: [10, 20, 30]
},
feb: {
item:{
title: "HTML",
amount: 200
},
point: [40, 50, 60]
}
}
function show(param){
for(var type in param){
if(Object.prototype.toString.call(param[type] ) === "[object Object]"){
show(param[type]);
}else if(Array.isArray(param[type])){
console.log(param[type])
}else{
console.log(type + ":" + param[type])
}
}
}
show(member)
// title:JS북 amount:100 (3) [10, 20, 30] title:HTML amount:200 (3) [40, 50, 60]
javascript
Answer
This question is waiting for answers
Be the first to answer!





