YEP Buff States Core, Respond Effect SOLVED

I am currently trying to make a state that, when the state affected enemy is hit by a specific element type, will add a different state to that enemy and remove the current state from that enemy. I am not well versed in JS so I may be making a simple error, but that is why I am asking the hivemind. The most current code I have tried is the following:

<Custom Respond Effect>
if (this.getItemElements().contains(2))
{
b.addState(28);
b.removeState(27);
}
</Custom Respond Effect>

This is located in the notetag of the state (27).
Any help would be greatly appreciated.
There's no such thing as contains() - the correct JavaScript method is includes()

Also, getItemElements() is only valid if you are using Yanfly's Element Core.
Ah okay, thank you. I found the ".contains" part in another thread and thought I needed it. I am using Element Core, but what is the syntax I need to determine the element type and use it in an if statement? "if (getItemElements() == 2)"? or "if (getItemElements().includes(2))"? Alternatively, is there something I should be using INSTEAD of "getItemElements()"?

EDIT: I got it working with the following code:

<Custom React Effect>
if (this.item().damage.elementId === 2);
{
b.addState(28)
b.removeState(27)
}
</Custom React Effect>

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/yep-buff-states-core-respond-effect-solved.165628/