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

是否采用onevar? #2

Open
2betop opened this issue Apr 23, 2014 · 5 comments
Open

是否采用onevar? #2

2betop opened this issue Apr 23, 2014 · 5 comments

Comments

@2betop
Copy link
Contributor

2betop commented Apr 23, 2014

本来我是推荐使用onevar, 但是看了这个之后,我改变主意了。

但是,还是希望同一作用域下, 所有的变量在一个地方申明。

@Singularity-zju
Copy link
Contributor

个人感觉one var 只用于写在一行里比较合适。 多行的话容易忽略犯错。

变量还是尽量在函数开头声明好了,虽然要麻烦点。现在有人喜欢写 for (var i=0; i<100; i++){} 这种,比较容易误导。

@2betop
Copy link
Contributor Author

2betop commented Apr 23, 2014

完全赞同!

@nwind
Copy link
Member

nwind commented Apr 24, 2014

同俊哲

@miller miller modified the milestones: pre alpha, 1st edition Apr 25, 2014
@techird
Copy link
Member

techird commented Apr 30, 2014

one var -1

@hefangshi
Copy link
Member

for (var i=0; i<100; i++){}

这种写法还是比较自然的吧?我觉得函数内的变量随用随声明比较清晰。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants