Open remarcmij opened 6 years ago
Thanks mr.Jim for your feedback, I fixed it , i am looking forward to hearing from you the new feedback.
Hi Jim,
Here is my updated feedback:
.eslintrc.json
file should be created in the root folder of the repo (hyf-javascrip1
). This is the folder that you should in VSCode when you work on your homework.week2
and not week1
.exercise 3
let x;
. However the assignment asked for '3.1 First, declare your variable x(do not initialize it yet).' The idea was to predict that the value would be undefined
and then console.log it to confirm your prediction.exercise 4
exercise 5
let m = "";
if (z > a) {
let m = z;
}
else {
let m = a
}
console.log(m);
All variables declared with let
have block scope. Therefore the variables m
inside the if
and else
block are different from the first m
variable. When you console.log the variable m
you will see that it is an empty string and not the highest of the two numbers. If all is well you should have seen in VSCode that the m
variables inside the if
statement are green underlined by eslint. You should follow up on warnings like that. See if you can solve the bug.
Also take note of the formatting if the if
statement.
Note: if you want to declare a variable without initialising it just do let m;
. This declares the variable but leaves its value undefined. There is no point in assigning it an empty string as you did in let m = "";
Besides using an if
statement, there is also another way of finding the highest of two numbers. Google for 'mdn math' and see what you can find.
exercise 6
let myEmptyArray = [];
. What you have defined is a non-empty array with three elements, each consisting of an empty string."Baby Pig"
.'
or double "
quotes to define strings. Choose one or the other and then use it consistently.exercise 7
length
is green underlined by eslint. It warns that you have assigned this variable a value but are not using it.exercise 8
You should not use else if
here. This causes all subsequent conditions to be skipped as soon a condition is evaluated as true
. Suppose name === age
was true
(it is not, but just suppose). That would print out the first console.log statement and then skip all the other tests.
The correct way is to have separate if
statements for each condition:
if (name === age) {
console.log(name + 'and' + age + 'are the same type');
}
if (name === arr) {
console.log(name + 'and' + arr + 'are the same type');
}
...
Bottom line: still one bug to fix.
Hi Jim, here is my feedback on your homework.
.eslintrc.json
file that we discussed in the lecture. Please check the VSCode Tips on how to create one.week1
should actually be calledweek2
asweek1
was the Git session with Unmesh.When I run your Christmas.js file I get immediately a run-time error:
That means I can't continue the review until you make corrections. How did you test your code? Please make sure that what you give me to review is able to run without requiring modifications from my side.
Let me know when it is corrected and I'll look again.