I initialize my constant index variable (inside of case code block) by expression that returns 2. But I see index value is undefined... How it possible?
I created this project through create-react-app command and clear all JS and CSS files in the src subdirectory.
I published code sources of my example here: https://github.com/Andrey-Bushman/i-learn-redux (You can run the project by npm start or yarn start command).

Console output:

The findIndex is native function:

This is a bug in Chrome DevTools. index does have the value 2 - you will notice this if you console.log(index). It looks like Chrome DevTools has a problem with the index variable being defined twice in this function.
If you rename one occurrence, Chrome DevTools displays the correct value.
Also, in Local you will see another variable _index which has the correct value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With