Need help with phaser.js

please help me this code i wrote isn’t working correctly

 function preload() {
  this.load.image('bug1', 'https://content.codecademy.com/courses/learn-phaser/physics/bug_1.png');
  this.load.image('bug2', 'https://content.codecademy.com/courses/learn-phaser/physics/bug_2.png');
  this.load.image('bug3', 'https://content.codecademy.com/courses/learn-phaser/physics/bug_3.png');
  this.load.image('platform', 'https://content.codecademy.com/courses/learn-phaser/physics/platform.png');
  this.load.image('codey', 'https://content.codecademy.com/courses/learn-phaser/physics/codey.png');
}

const gameState = {
  score: 0
  var health = 5;
};

function create() {
  gameState.player = this.physics.add.sprite(225, 450, 'codey').setScale(.5);
  const platforms = this.physics.add.staticGroup();

  platforms.create(225, 490, 'platform').setScale(1, .3).refreshBody();

  gameState.scoreText = this.add.text(195, 485, 'Score: 0', { fontSize: '15px', fill: '#000000' });

  gameState.player.setCollideWorldBounds(true);

  this.physics.add.collider(gameState.player, platforms);
  
	gameState.cursors = this.input.keyboard.createCursorKeys();

  const bugs = this.physics.add.group();
 const hp = this.physics.add.group();
  function bugGen () {
    const xCoord = Math.random() * 450;
    bugs.create(xCoord, 10, 'bug1');
  }
  function hpGen () {
    const xCoord = Math.random() * 450;
    hp2.create(xCoord, 10, 'bug2');
  }

  const bugGenLoop = this.time.addEvent({
    delay: 100,
    callback: bugGen,
    callbackScope: this,
    loop: true,
  });
  const hpGenLoop = this.time.addEvent({
    delay: 100,
    callback: hpGen,
    callbackScope: this,
    loop: true,
  });
  this.physics.add.collider(bugs, platforms, function (bug) {
    bug.destroy();
    gameState.score += 10;
    gameState.scoreText.setText(`Score: ${gameState.score}`);
  })
    this.physics.add.collider(hp, platforms, function (hp2) {
    hp2.destroy();
    gameState.score -= 10;
    gameState.scoreText.setText(`Score: ${gameState.score}`);
  })
  const healthloop = {
  if (health = 0) {
   this.physics.pause();
    this.add.text(180, 250, 'Game Over', { fontSize: '15px', fill: '#000000' });
    this.add.text(152, 270, 'Click to Restart', { fontSize: '15px', fill: '#000000' });  
  }
  this.add.text(200, 100, 'health' + health,{fontSize: '10px', fill: '#000000'});
  loop: true,
  }
  this.physics.add.collider(gameState.player, bugs, () => {
    bugGenLoop.destroy();
   health -= 1;
      this.physics.add.collider(gameState.player, hp, () => {
    hpGenLoop.destroy();
    health++;
      }
		// Add your code below:
    this.input.on('pointerup', () =>{
      gameState.score = 0;
    	this.scene.restart();
    });
  });
}

function update() {
  if (gameState.cursors.left.isDown) {
    gameState.player.setVelocityX(-160);
  } else if (gameState.cursors.right.isDown) {
    gameState.player.setVelocityX(160);
  } else {
    gameState.player.setVelocityX(0);
  }
}

const config = {
  type: Phaser.AUTO,
  width: 450,
  height: 500,
  backgroundColor: "b9eaff",
  physics: {
    default: 'arcade',
    arcade: {
      gravity: { y: 200 },
      enableBody: true,
    }
  },
  scene: {
    preload,
    create,
    update
  }
};

const game = new Phaser.Game(config);

does anyone know why?

Hi @hotdogger2020
I recommend pasting your code to an editor which gives you clear error messages (like fiddle). There are several syntax errors in your code like var declarations inside objects (for example gameState) and missing commas after key-value-pairs.