Skip to content
New issue

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

是不是挺多变量声明之后没有用到? #7

Closed
jsonz1993 opened this issue Apr 27, 2017 · 5 comments
Closed

是不是挺多变量声明之后没有用到? #7

jsonz1993 opened this issue Apr 27, 2017 · 5 comments

Comments

@jsonz1993
Copy link

比如说 this.handles["ok"] = true; 比如说 this.isCallback 只是看了两遍,没发现有用到,不是很明白写在那里的用意

@jsonz1993
Copy link
Author

而且 _validateField 循环里面的 j变量....好像没有声明直接就使用了

                for (j = 0; j < this.errors.length; j += 1) {
                    if (field.element === this.errors[j].element) {
                        existingError = this.errors[j];
                    }
                }

@jaywcjlove
Copy link
Owner

jaywcjlove commented Apr 27, 2017

@jsonz1993
this.isCallback 下面这一句 #L85 这里判断了这个就没有用了,冗余了。

this.handles["ok"] = true;
this.handles["evt"] = evt;

这种是有用的,在回调里面可以做一些判断 #L146

而且 _validateField 循环里面的 j 变量,这里面是在浏览器里面不报错的,这种写法叫隐式的将j声明为全局变量。我经常拿这个考面试者,但是这种习惯十分不好,不便于阅读理解,应该是我忘记了吧。😂😂

for (j = 0; j < this.errors.length; j += 1) {
// ....
}

@jsonz1993
Copy link
Author

我的天!大佬 原来可以直接连接到code。 正在看代码 挺赞的。这个issues先留两天吧,我这两天看代码,如果有什么疑问再上来问大佬

@jaywcjlove
Copy link
Owner

@jsonz1993 勤奋的好孩子,这个代码很利于你学习js基础。

我的这两个小玩意儿,也是学习的小例子

store.js
cookie.js

@jsonz1993
Copy link
Author

start 了。表单验证这块,因为公司用的是es6语法,所以重新封装了一次。 后面使用一段时间再分享出来

jaywcjlove added a commit that referenced this issue Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants