function keysWithNonEmptyValues(obj) {
return Object.keys(obj).reduce((acc, key) => {
if (obj[key] !== '') {
acc.push(key);
}
return acc;
}, []);
}
// 示例使用
const exampleObject = { a: 'value1', b: '', c: 'value3', d: 'value4', e: '' };
const keysWithNonEmpty = keysWithNonEmptyValues(exampleObject);
console.log(keysWithNonEmpty); // 输出: ['a', 'c', 'd']