i am getting error if i use while creating an object.
"ok_count": s.status !== (-3 && -2 && -1 && 0 && 1) ? "1" : "0"
Do anyone have any idea how can i use conditional operator with Logical &
i am getting error if i use while creating an object.
"ok_count": s.status !== (-3 && -2 && -1 && 0 && 1) ? "1" : "0"
Do anyone have any idea how can i use conditional operator with Logical &
You have to individually compare each value
"ok_count": (s.status !== -3 && s.status !== -2 && s.status !== -1 && s.status !==0 && s.status !==1) ? "1" : "0"
or you can use a shortcut with an array includes method like
"ok_count": ![-3, -2, -1, 0, 1].includes(s.status) ? "1" : "0"
or if your range is continues you can use >= and <=
operators
"ok_count": (s.status >= -3 && s.status <= 1)? "1" : "0"