Help With Back To Basics Using Functions

I would appreciate it if someone can help me with this basic function question.

Here is some code which returns whether the image is RGBColor or something else.

async function imageMode() {

  await exeModal(doStuff, {
    "commandName": "Please Wait"
  });

  async function doStuff(executionContext) {

    //do stuff here..
    const result = await batchPlay(
      [{
        _obj: "get",
        _target: [{
          _ref: "document",
          _id: 219
        }],
        _options: {
          dialogOptions: "dontDisplay"
        }
      }], {
        synchronousExecution: false
      });
    const pinned = result[0].mode._value;
    
    console.log(pinned);

  }
}

This works fine and outputs the result to the console.
What I am trying to learn is how to call this function anywhere and output the result.

You don’t need exeModal() for getters :thinking: Just do a BP and get the result

Can you give me an example from my code so I can learn please if you have time

Ah, I see what you mean thank you