
2020
沐游虞
这个作者很懒,什么都没留下…
展开
-
给for循环加点bug
这一段会输出什么值呢?let arr = [1, 2, 0, 3]for (let i = 0, val; val = arr[i++]; ) { // ...}答案:只会输出1和2。原因:当i=2的时候取出来的值是0,ta是会被判定为false的,所以就退出循环。如何解决这种情况呢,自己手写判断条件。let arr = [1, 2, 0, 3]for (let i = 0, val; ; ) { val = arr[i++] if (val === undefined原创 2020-12-12 10:29:51 · 172 阅读 · 0 评论 -
react引用其他组件Error: Element type is invalid: expected a string (for built-in components) or a class/fu
报错详情如下Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up原创 2020-05-22 11:50:41 · 34004 阅读 · 0 评论