I am running the following code and getting unexpected results:
var a = 1, b =2 ,c = 3;
console.log(5*a+ b>0?b:c);
I am running the following code and getting unexpected results:
var a = 1, b =2 ,c = 3;
console.log(5*a+ b>0?b:c);
Copyright © 2021 Jogjafile Inc.
Your code has the right concept, but wrong execution. The ternary is doing its job properly.
At the moment, your code is executing like this:
You should use brackets to separate the ternary: