How to change marker of the selected point?

I'm trying to change marker for selected point and it seems be doable but I'm failing to figure it out how.

My best guess was to run this script on point select:

  function setMarkerToGreen(selectedPointId) {
    const index = Branches.visiblePoints.findIndex(point => === selectedPointId);

    point = Branches.visiblePoints[index];
    if (point) {
      Branches.visiblePoints[index].marker = "🟢";

but this does not change selected point marker.

Can somebody give me a hand here?

Hey there!

This code seems to be on the correct track, but without more context its tough to say what the exact problem is. Which part of the code is causing an error?