JSFiddle - React, Tailwind, and code Playground

JavaScript

let storage;

function runDemo() {
  taskOne();
  console.log(storage);
  return storage;
}


function taskOne() {
  taskTwo();
}

function taskTwo() {
  taskThree();
}

function taskThree() {
  taskFour();
}

function taskFour() {
  const localArray = [1, 2, 3];
  storage = localArray;
  //Here storage is assigned properly and outputs the data I want
  console.log(storage);
}

runDemo();