I have this simple code
let pathFinder = (entranceX, entranceY, grid) => {
let distanceFromTop = entranceX;
let distanceFromLeft = entranceY;
let location = {
distanceFromTop: distanceFromTop,
distanceFromLeft: distanceFromLeft,
path: [],
status: 'Start'
}
console.log('start', location)
let queue = [];
queue.push(location);
console.log('queue', queue)
}
And I made sure that "location" is not empty, it shows just fine in the console as:
"start {distanceFromTop: 1, distanceFromLeft: 0, path: Array(0), status: "Start"}"
but when I want to add it to the queue I end up with something that doesnt look like an empty array, but the length is 0
"queue [{…}] length :0"
Am i missing something obvious? Tried to add it via queue[location] but it also didnt work
start { distanceFromTop: 23, distanceFromLeft: 56, path: [], status: 'Start' } queue [ { distanceFromTop: 23, distanceFromLeft: 56, path: [], status: 'Start' } ]as result.