-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2014年12月29日 D5 #34
Comments
var flattenMap=function(){
} for(var key in a){ return result; |
1 顺序不对 2 属性名不是单个字母的时候na.split("").join("/")有问题 。抛砖引玉啊 |
function test(a){ |
function flattenMap(map,cache) {
var a = cache || [];
for(key in map){
a.push(key);
if(map[key].constructor === Object){
flattenMap(map[key],a)
}else{
console.log(a.join("/")+": "+map[key])
}
a.pop()
}
} |
还是@srw4115 写的好,小改下:
|
@XadillaX 大神能否来解下这道题呢?话说你好久没回everycode了 |
|
var a = { |
写一个函数,可以把一个对象转换成一个扁平的对象
具体如下:
The text was updated successfully, but these errors were encountered: