var dict = {
'Type1':'.typ1',
'Type2':'.typ2',
'Type3':'.typ3'
}
Any chance there's a concise one-liner to produce CSV like following:
".typ1,.typ2,.typ3"
var dict = {
'Type1':'.typ1',
'Type2':'.typ2',
'Type3':'.typ3'
}
Any chance there's a concise one-liner to produce CSV like following:
".typ1,.typ2,.typ3"
Share
Improve this question
edited Nov 14, 2014 at 21:34
Pointy
414k62 gold badges595 silver badges629 bronze badges
asked Nov 14, 2014 at 20:46
RodRod
15.5k35 gold badges134 silver badges264 bronze badges
1
-
5
Sure:
Object.keys(dict).map(function(k){return dict[k];}).join(',');
. You're wele. – Felix Kling Commented Nov 14, 2014 at 20:47
2 Answers
Reset to default 4Object.keys(dict).map(function(k){
return dict[k];
}).join(',');
jQuery solution :
var str = $.map(dict, function(x){return x}).join();
DEMO
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744750165a4591546.html
评论列表(0条)