What I want to do is check if there is element in array, if it is, I want to increment counter. Compiler reports error when I do count++ but not when I do count + 1, and it increments correctly. Is it because count++ is operation and not an expression, and count + 1 is expression?
let count = 0;
//not working
count = checkArr(arr) ? count++ : count;
//working
count = checkArr(arr) ? count + 1 : count;