Evgenii Bazhanov
Evgenii Bazhanov

Reputation: 926

Quiz question -> The following program has a problem. What is it?

The following program has a problem. What is it?

var a;
var b = (a = 3) ? true: false

I am not sure that the code has any problems to run. Code looks good, and JavaScript Engine is able to understand it I guess.

However, I think the condition in the ternary is using the assignment operator. is close to the correct answer because the others can not be the answer.

Guys, please any ideas or explanation what the answer can be?

Upvotes: 0

Views: 5643

Answers (1)

Lee Evans
Lee Evans

Reputation: 81

Yes you are correct, the code is using the assignment operator rather than conditional

Upvotes: 1

Related Questions