Trying to make a Jump system in MZ

Ok, so I put this: $game_map.passable? ($game_player.x+2, $game_player.y)
in a conditional for the script, but it tells me that there's an "unexpected end to input." How can I fix it

1726534564013.png
Where did you get that code? None of that is valid JavaScript.

Why not just use an existing plugin that adds a jump button to your game?
Ok, so I put this: $game_map.passable? ($game_player.x+2, $game_player.y)
in a conditional for the script, but it tells me that there's an "unexpected end to input." How can I fix it

View attachment 317945

MOVING & JUMPING PLAYER BY PRESSING A S D F KEYS AND SPACE BUTTON​

I was going to make a new thread for this script, but figured I'd drop it here instead.
I made a common event for jumping and wrote this script to put inside it, then I used the PKD Key Commands plugin to map a key to that common event.

Spoiler: Script
Code:
const direction = $gamePlayer.direction();
let x = 0;
let y = 0;
let xa = 0;
let ya = 0;
switch (direction) {
case 2: // Down
y = 2;
ya = 1;
break;
case 4: // Left
x = -2;
xa = -1;
break;
case 6: // Right
x = 2;
xa = 1;
break;
case 8: // Up
y = -2;
ya = -1;
break;
}

  // Calculate the target coordinates for one and two spaces away
  const targetX = $gamePlayer.x + x;
  const targetY = $gamePlayer.y + y;
  const targetXSingle = $gamePlayer.x + xa;
  const targetYSingle = $gamePlayer.y + ya;

  // Check if the target tile has terrin tag 5
  const terrainTag = $gameMap.terrainTag(targetX, targetY);
  const terrainTagSingle = $gameMap.terrainTag(targetXSingle, targetYSingle);
 
  if (terrainTag !== 5) {
    $gamePlayer.jump(x, y);
  }
  else if(terrainTagSingle !== 5){
    $gamePlayer.jump(xa, ya);
  }
  else {
    $gamePlayer.jump(0, 0);
  }


Key Commands Plugin:

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-a-jump-system-in-mz.171957/