Skip to content

Commit c0d1b93

Browse files
committed
replaced var with let in ES6 code examples
1 parent 5508453 commit c0d1b93

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ var text = [
232232
**Template Literals** will preserve new lines for us without having to explicitly place them in:
233233

234234
```javascript
235-
var text = (
235+
let text = (
236236
`cat
237237
dog
238238
nickelodeon`
@@ -263,7 +263,7 @@ var d = arr[3];
263263
```
264264

265265
```javascript
266-
var [a, b, c, d] = [1, 2, 3, 4];
266+
let [a, b, c, d] = [1, 2, 3, 4];
267267
console.log(a); // 1
268268
console.log(b); // 2
269269
```
@@ -277,8 +277,8 @@ var father = luke.father; // 'anakin'
277277
```
278278

279279
```javascript
280-
var luke = { occupation: 'jedi', father: 'anakin' }
281-
var {occupation, father} = luke;
280+
let luke = { occupation: 'jedi', father: 'anakin' }
281+
let {occupation, father} = luke;
282282
console.log(occupation); // 'jedi'
283283
console.log(father); // 'anakin'
284284
```
@@ -303,8 +303,8 @@ module.exports = function bar () {}
303303
With ES6, we have various flavors of exporting. We can perform **Named Exports**:
304304

305305
```javascript
306-
export var name = 'David';
307-
export var age = 25;​​
306+
export let name = 'David';
307+
export let age = 25;​​
308308
```
309309

310310
As well as **exporting a list** of objects:
@@ -344,7 +344,7 @@ function sumThree(a, b) {
344344
return a + b + c;
345345
}
346346

347-
var api = {
347+
let api = {
348348
sumTwo : sumTwo,
349349
sumThree: sumThree
350350
}
@@ -738,4 +738,4 @@ Promise.all(urlPromises)
738738
.catch(function(err) {
739739
console.log("Failed: ", err);
740740
});
741-
```
741+
```

0 commit comments

Comments
 (0)