MZ Learning javascript how to check if you have item in the inventory[SOLVED]

learning javascript from the scratch so im trying to do an item inventory check
if that item is in the inventory ill just print in the window that i have that item
how do i do that..

this what i do so far
1655096863516.png


if ($gameParty.item[4] == true) {
this.drawTextEx('you have that item', 0, 0); }

if ($gameParty.item[4] = true) {
this.drawTextEx('you have that item', 0, 0); }

still throwing error please help me guys

edit: sorry im idiot i misspell the the variable it should be this $gameParty.items(4)
but it does not display the text


EDIT:: yeahhh I did it in case people need it ill just post it here

JavaScript:
refresh() {
            this.contents.clear();
            if ($gameParty.hasItem($dataItems[4]) == true) {
                this.drawTextEx('you have item', 0, 0);
            } else {
                this.drawTextEx('you do not have the item', 0, 0);
            }
           
           
        }

Original thread: https://forums.rpgmakerweb.com/threads/learning-javascript-how-to-check-if-you-have-item-in-the-inventory-solved.148495/