Skip to content

Commit 9e5dc82

Browse files
SSmalejamesgeorge007
authored andcommitted
Chore(Solutions): Use const and let not var (#25)
1 parent fe1d279 commit 9e5dc82

File tree

10 files changed

+20
-18
lines changed

10 files changed

+20
-18
lines changed

src/workspace/js/solutions/task10.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var s = 1;
1+
let s = 1;
22
do {
33
if (s % 2 === 0) {
44
console.log(s + ' is even.');

src/workspace/js/solutions/task11.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var i = 1;
1+
let i = 1;
22
while (i <= 15) {
33
if (i % 3 === 0) {
44
i++;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
var str = 18;
1+
const str = 18;
22
console.log(str);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
var str = 'JS is cool!';
1+
const str = 'JS is cool!';
22
console.log(str);

src/workspace/js/solutions/task4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
var str = ' Hey, this is Task 4 of JS Path! ';
1+
const str = ' Hey, this is Task 4 of JS Path! ';
22
console.log(str.length);
33
console.log(str.indexOf('Task'));
44
console.log(str.slice(24, 26));
5-
var str1 = str.replace('JS', 'Python');
5+
let str1 = str.replace('JS', 'Python');
66
console.log(str1);
77
str1 = str1.concat('!');
88
console.log(str1);

src/workspace/js/solutions/task5.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var a = 25;
2-
var b = 33;
1+
const a = 25;
2+
const b = 33;
33
console.log(a + b);
44
console.log(a - b);
55
console.log(a * b);

src/workspace/js/solutions/task6.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
var a = 44;
2-
var b = 29;
3-
console.log(a === b);
1+
const a = 44;
2+
const b = 29;
3+
// eslint-disable-next-line eqeqeq
4+
console.log(a == b);
45
console.log(a === b);
56
console.log(a !== b);
67
console.log(a > b);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var a = 34;
2-
var b = 23;
3-
var c = 1;
1+
const a = 34;
2+
const b = 23;
3+
const c = 1;
44
console.log(a > b && a < c);
55
console.log(a < b || a > c);
66
console.log(!(b < a));
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
var i = 1;
2-
for (i = 1; i <= 12; i++) {
3-
if (i % 4 === 0) console.log(i);
1+
for (let i = 1; i <= 12; i++) {
2+
if (i % 4 === 0) {
3+
console.log(i);
4+
}
45
}

src/workspace/js/solutions/task9.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var x = 1;
1+
let x = 1;
22
while (x <= 50) {
33
if (x % 5 === 0) {
44
console.log('Buzz');

0 commit comments

Comments
 (0)