We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
与 Diff 算法有关系,Diff 算法是同层比较,可以另外这个文章:lovelmh13/One-question-a-day#37
如果用了 index,我们调换数组的顺序: ['a', 'b', 'c'] -> ['c', 'b', 'a']
虽然数组的内容是变了,但是数组的 index,还是原来的 index,并不会内容变了,就改变索引, 索引依然是 0 1 2。所以写了跟没写一样,还是会复用元素。
所以在需要改变顺序的需求下,不要使用 index 作为 key
The text was updated successfully, but these errors were encountered:
No branches or pull requests
与 Diff 算法有关系,Diff 算法是同层比较,可以另外这个文章:lovelmh13/One-question-a-day#37
如果用了 index,我们调换数组的顺序: ['a', 'b', 'c'] -> ['c', 'b', 'a']
虽然数组的内容是变了,但是数组的 index,还是原来的 index,并不会内容变了,就改变索引, 索引依然是 0 1 2。所以写了跟没写一样,还是会复用元素。
所以在需要改变顺序的需求下,不要使用 index 作为 key
The text was updated successfully, but these errors were encountered: