Printing Partial Name From Array

I’ve got an array made up of function names:

Gz = [Waterpump, Cyclotron, Conveyor, BoxDance, Tumblers, Giza, Lunar, Luxor, Trapeze, Sticks, Plus3, Bowtie, FourWalls, SquarePeg, Clockwork, Atomic, Batman, Robin, PolloLoco, Flo, Daddio, FourEyes, Spike, Wiperbot, Bloopy, Grimbot, PieFace];

print(Gz);

When I print out the contents of Gz[] it prints “function Waterpump(), function Cyclotron()…”

How would I print a list of the function names without the “function” preceding the name and the “()” following the name?

Here’s a link to an editor with the rest of the sketch: https://editor.p5js.org/cottonchipper/sketches/zQ6JGhVIz

const functs = [ setup, draw ];
const functNames = functs.map(funct => funct.name);

function setup() {
  noLoop();
  print(functs);
  print(functNames);
}

function draw() {
  background('blue');
}
2 Likes
for (let i = 0; i < Gz.length; i++) {
  print(Gz[i].name);
}
2 Likes
  • for (const funct of Gz) print(funct.name);
  • for (const { name } of Gz) print(name);
2 Likes

Thank you both for the help!