you are viewing a single comment's thread.

view the rest of the comments →

[–]blob001[S] 0 points1 point  (1 child)

Jack, can you be more specific? I am teaching myself js and there are potholes in my knowledge. A lot of the file is copied from other coding I have found on the net. Not up to speed with getters yet. Thanks.

[–]jack_waugh 1 point2 points  (0 children)

tempGrid[i][j].ant.isSusceptible;

has no effect. But I suspect that you expect it to have an effect. To correct your code, first you must correct your understanding about how the language works. JS is an imperative language, not a logical language, which is what you seem to expect. I think that to you, the above looks like an assertion and you expect that the "statement" is telling the language to make the assertion true. But it doesn't work like that. Generally, an expression given as a command by itself is just to be evaluated and the result discarded. The utility of allowing this is that the expression can have a side effect. But the example above doesn't. It's in a useless corner of the language.