I have:
arrFrom = [{a: 1, b: 1}, {a: 1, b: undefined}]
arrTo = []
And I try to create new arrTo from arrFrom:
for (let value of arrFrom){
arrTo.push({x: value.a, y: value.b })
}
I need to catch undefined value. I know, I can use function or operators like:
arrTo.push({x: value.a, y: value.b || 0 })
arrTo.push({x: value.a, y: value.b ? value.b: 0 })
Can I use 'in' operator/callback/other style?
EDIT: Thanks for comments, I meant if could use syntax like this(this doesn't work):
arrTo.push({x: value.a, y: ('undefined' in value.b) ? true: 0 })