I have an object named x
. It looks similar to this:
{
a: 123,
b: null,
c: [1, 2, 3]
}
I want to get the names of all the keys that are truthy, so I need to get an array that looks something like ["a", "c"]
, because x.a
and x.c
are truthy, but x.b
is not. How can I do this?