Skip to content
This repository has been archived by the owner on Jun 15, 2019. It is now read-only.

Change all variable declaration to ES6 #814

Open
creesch opened this issue Feb 19, 2017 · 2 comments
Open

Change all variable declaration to ES6 #814

creesch opened this issue Feb 19, 2017 · 2 comments
Assignees

Comments

@creesch
Copy link
Member

creesch commented Feb 19, 2017

So no more var and instead let and const:

const for variables that will not be updated.
let for variables that (possibly) will be updated.

Note:

const doesn't mean immutable as properties in a const object can be changed. To avoid confusion I suggest using let for objects.

@creesch creesch self-assigned this Feb 19, 2017
@agentlame
Copy link
Collaborator

I understand const. But how does let differ from var?

@creesch
Copy link
Member Author

creesch commented Feb 20, 2017

From mdn

let allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used. This is unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope.

In other words, let is a bit more specific and should prevent some reassignment bugs and that.

eritbh added a commit that referenced this issue Aug 8, 2017
TODO: Figure out which of these can be const instead of let
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants