That article excerpt is both correct and incorrect. It's correct that the body of the if will not be entered with if (x = 0), but it's incorrect when it says why.
The incorrect part is highlighted:
Instead of checking whether the variable x has the value 0 the example above will assign the value 0 to x. The body of the if statement will not be executed because the assignment expression results in undefined which is falsy (sic).
That's just plain wrong. The result of an assignment expression is the value that was assigned, not undefined, so if (x = 0) won't enter the body of the if (because 0 is falsey), but if (x = 1) will (because 1 is truthy).
Is it a matter of JS version?
No, it's always been this way. Someone just got it wrong in those docs.
In fact I made a mistake assuming that is possible to use the result of an assignment as a test value.
It wasn't a mistake, you can — and sometimes, you want to. This is fairly common, for instance:
while ((thing = getMeTheNextThing()) != null) {
// ...do something with `thing`
}
That's also using the result of an assignment as a test. Sometimes people even write it like this:
while (thing = getMeTheNextThing()) {
// ...do something with `thing`
}
...although I never do, because it's just too easy to see that as an == and mess something up.
Note that it's very, very rare to want to assign to a variable within an if statement. It does happen, but it's really rare, and most style guides will suggest you break up the assignment and the branch.
Almost always, when you see if (x = 0), what the author meant to write was if (x == 0) or if (x === 0). That is, they meant to test the value of x, not assign a new value to x.
Example of what the JSLint docs mean about assigning zero:
var x;
snippet.log("first test: using 0");
if (x = 0) {
snippet.log("entered if body");
} else {
snippet.log("entered else body");
}
snippet.log("second test: using 1");
if (x = 1) {
snippet.log("entered if body");
} else {
snippet.log("entered else body");
}
<!-- Script provides the `snippet` object, see http://meta.stackexchange.com/a/242144/134069 -->
<script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>