我有喜欢的数组:选号键包含在Javascript
var arr = ["hello","world"]
// This array can contain any number of strings
对象是这样的:
var obj_arr = {
"abc-hello-1": 20,
"def-world-2": 30,
"lmn-lo-3": 4
}
我想有这只有那些包含对象键,它包含上面的数组值作为子字符串。 对于如:
结果会是这样的:
var result = {
"abc-hello-1": 20,
"def-world-2": 30,
}
我想要做这样的事情(使用lodash):
var to_be_ensembled = _.pickBy(timestampObj, function(value, key) {
return _.includes(key, "hello");
// here instead of "hello" array should be there
});
感谢。任何奇特的方式使用lodash? – Ashag