Referencing functions within object properties does not work

Pasting the sketch below on My Sketch - OpenProcessing action1() is invoked normally: :partying_face:

'use strict';

const keys = {
  ArrowUp: action1
};

function setup() {
  background(100);
}

function action1() {
  console.info('ArrowUp detected!');
}

function keyPressed() {
  print(`Key ${ key } pressed!`);

  const funct = keys[key];

  if (funct) {
    print(funct);
    funct();
  }
}
1 Like