I'm dealing with an object:
{
a_suff:"Something",
b_suff: "Value",
c: "Value",
d: "Value,
e_suff: "Value"
}
I'm looking for a way to extract all the keys that end in "_suff". What would be the most efficient solution?
Currently, I have this implementation:
function getFilterKeys(filter) {
var filtered = {};
for(var key in myobject) {
if(key.endsWith(filter)) {
filtered[key] = myobject[key];
}
}
return filtered;
}
Are there any easier methods or built-in prototype functions for achieving this task?