var

Use const for all of your references; avoid using var. eslint: prefer-constno-const-assign

Why? This ensures that you can’t reassign your references, which can lead to bugs and difficult to comprehend code.

// bad
var a = 1;
var b = 2;

// good
const a = 1;
const b = 2;
posted @ 2017-12-21 15:35  danawill  阅读(101)  评论(0编辑  收藏  举报