Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

How to pick only one object from the lish that has data and ignore the rest

Hi guys,
It's me again. I'm checking if objects containg value with Object.keys like below:
Object.keys(obj).length
Code (markup):
It would return the list like this:
0
0
0
3
0
0
Code (markup):
The list is unordered and number of items is variable depending on an amount of objects being checked. It would generated automatically. So how do I pick the only one that has data and ignore the rest.
I do the switch and it isn't working.

var flag;
switch (Object.keys(obj).length) {
    case 3:...
Code (markup):
How to pick only one object from the lish that has data and ignore the rest

from JavaScript https://ift.tt/2SlYycj
via IFTTT

Post a Comment

0 Comments