codesandbox-client icon indicating copy to clipboard operation
codesandbox-client copied to clipboard

element is removed from array without my command.

Open ImTemporaryHere opened this issue 4 years ago • 1 comments

🐛 bug report

Preflight Checklist

  • [x] I have read the Contributing Guidelines for this project.
  • [x] I agree to follow the Code of Conduct that this project adheres to.
  • [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

Description of the problem

element from array just was removed without any commands, i checked in browsers console i have another result.

How has this issue affected you? What are you trying to accomplish?

I'm trying to write a class for solving some task.

To Reproduce

run sandBox and look at the console : there is backPack array on wich i loock for some element, and its being found, but in very next console.log of the backPack array you wont see that element that just was found there. but if you do same in browsers console you will see another result. https://codesandbox.io/s/optimistic-chihiro-zrbe2u?file=/src/index.js:0-3848

Link to sandbox: [link]() (optional)

Your Environment

Software Name/Version
Сodesandbox https://codesandbox.io/s/optimistic-chihiro-zrbe2u?file=/src/index.js:0-3848
Browser yandex
Operating System win 10

ImTemporaryHere avatar May 28 '22 22:05 ImTemporaryHere

The call to this.backPack.splice modifies the backPack array, removing the element in question. When you console.log a value, the printed value may be from before or after the call to splice, depending on the implementation of the console. Your browser console appears to print the value of the array from before the call to splice, while the preview console prints it after.

aj-foster avatar Jul 25 '22 20:07 aj-foster