How to detect simultaneous keypress in p5.js

I’m trying to implement an undo functionality in a sketch. I need to detect simultaneous key press in p5. i.e ‘Ctrl’ and ‘z’ together? Is it possible?

1 Like

like this?
https://editor.p5js.org/kll/sketches/j0ybQZIxHD

2 Likes

p5js.org/reference/#/p5/keyTyped

function keyTyped() {
  const k = keyCode;

  if (k == 26)  print('CTRL + Z');

  return false;
}
2 Likes