Trying to Edit Damage Formula based upon states

I actually don't know for sure what it would be considered? What would a pointer classify target.states().includes($dataStates[32]) as?
Well, it's a function that returns a boolean. So it's giving true or false, which are reserved words and their own values in JavaScript - they are neither numeric nor strings, they are boolean.

My mistake was the operation precedence (order of operations) - in JavaScript, the ternary operator is of lower precedence than multiplication, so it was multiplying "user.mat*true/false" before checking the truth of that...which obviously doesn't work.

It works if you put parentheses around it: Math.floor(user.mat * (target.states().includes($dataStates[32]) ? 0.3 : 0.5));
The function "includes" returns a boolean. True or false. It simply checks the array it's attached to, in this case, target.states(), to see if one of its elements matches the argument, in this case the data for state 32.

Most simple values in JS are interchangeable to a degree, mostly because JS doesn't have variable types, only value types, and any value can be put into almost any variable without needing any sort of conversion, like more "structured" languages. It sees number 6 and string "6" effectively as the same thing and will still perform math with it. I believe it converts it under the hood before evaluating. But it won't work with a string "six" because that's a word, not a number. It doesn't know or care that six is a word that represents 6.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-edit-damage-formula-based-upon-states.144535/