A
A
Alex102142021-06-15 17:56:38
JavaScript
Alex10214, 2021-06-15 17:56:38

How to check object values ​​for emptiness?

Hello, I have an object like this:

const obj = {
    value1: 'aaa',
    value2: '',
    value3: 'ccc',
    value4: 'ddd',
}

and there is a boolean variable. Can you please tell me how can I return a variable as true if the object has empty values? I'm just learning and stuck a bit

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
n1ksON, 2021-06-15
@Alex10214

const obj = {
    value1: 'aaa',
    value2: '',
    value3: 'ccc',
    value4: 'ddd',
};
const boolean = Object.values(obj).includes('')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question