Reputation: 12506
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:
Upvotes: 3
Views: 93
Reputation: 174329
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.
Upvotes: 3