🐛 bug report
Preflight Checklist
Description of the problem
Console logging order not logging as expected.
Each log shows the result of functions that haven't yet been called.
i.e logging order should be:
log1 = []
call function
log2 = [value]
call fucntion
log3 = [value, value]
Instead it's returning
log1 = [value, value]
call function
log2 = [value, value]
call function
log3 = [value, value]
To Reproduce
I've run this code in multiple IDE's and works as expected elsewhere.
const array = [];
const addValueToArray = (arr) => {
return arr.push(Math.floor(Math.random() * 5));
};
console.log(array); // empty array
addValueToArray(array);
console.log(array); // array with 1 random value
addValueToArray(array);
console.log(array); // array with two random values
Codesandbox

Codepen

Link to sandbox: link
Your Environment
Note when I originally I was on older Chrome version and CodeSandbox required updating, which i have since done to check the issue still exists.
| Software |
Name/Version |
| Сodesandbox |
Not sure where to find, but latest version as I just updated |
| Browser |
Chrome 91.0.4472.106 |
| Operating System |
macOS 11.3 |
🐛 bug report
Preflight Checklist
adheres to.
to file, without success.
Description of the problem
Console logging order not logging as expected.
Each log shows the result of functions that haven't yet been called.
i.e logging order should be:
Instead it's returning
To Reproduce
I've run this code in multiple IDE's and works as expected elsewhere.
Codesandbox
Codepen
Link to sandbox: link
Your Environment
Note when I originally I was on older Chrome version and CodeSandbox required updating, which i have since done to check the issue still exists.