How to create pause/resume key?

Hello everyone
How to create pause/resume key using Phaser 3?

here is my code:

function create(){
     this.pause = false;
     this.input.enabled = true;
     this.keyPause =  this.scene.input.keyboard.addKey("P");

function update(){
         this.pause = false;
         this.pause = true;

it is scucessful to pause the game, but fail to resume the game.

Anyidea??? Thank you very much

pause( [key] [, data])

Pause the Scene - this stops the update step from happening but it still renders.

So either use another scene, or just skip code yourself, like

update() {
    if (Phaser.Input.Keyboard.JustDown(keyPause)) this.pause = !this.pause;
    if (this.pause) return;