Dumie1 / hyf-javascript1

Homework Javascript 1
0 stars 0 forks source link

Feedback homework week 2 #1

Open remarcmij opened 6 years ago

remarcmij commented 6 years ago

Hi Dumi, here is my feedback on your homework for week 2.

Overall, your code looks good but take special note of item 4 below. Make sure you always ship code that runs.

1. Your repo is missing an .eslintrc file. Because of that you are missing out on the checks that ESLint can do on your code. Please create such a file in the hyf-javascript1 folder and paste in the content as given in the fundamental on Code Formatting.

2. In line 18 of 2-arrays.js, where you are looking for the index of meerkat, it would be better to save that index into a variable. The reason for that is because you are trying delete meerkat from the array in line 19. You should not "hard code" the number 1, but instead use the value you found earlier. Then you can easily deal with the situation of the index of meerkat being changed, e.g. because something was inserted, or that meerkat was deleted by some other code. In the latter case the index would be -1, indicating that nothing was found.

Example:

const meerkatIndex = favoriteAnimals.indexOf("meerkat");
console.log("Item to be deleted is at index: " + meerkatIndex);
if (meerkatIndex !== -1) {
  favoriteAnimals.splice(meerkatIndex, 1);
}
console.log(favoriteAnimals);

3. Looking at your 3-months.js file, which by the way runs correctly, I can see that you still need to update your VSCode settings to enable automatic formatting of your code. Perhaps on your new laptop this hasn't been done yet. Please check the instructions in the VSCode Tips on how to do this.

4. When I run your file 4-maartje.js I get this runtime error:

for (i = 0; i < tasks.length; i++) {
       ^

ReferenceError: i is not defined
    at Object.<anonymous> (/Users/jimcramer/hackyourfuture/class15/js1/dumie/week2_review/4-maartje.js:48:8)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

I assume your program was running but that you changed something and forgot to try and run it again. Be sure to do a final run of your code before submitting your homework. Please fix this problem.

Why did you include Math.floor() in line 57 of your code?

And, as Husam said, you need to include two decimals for a Euro amount (accurate up to Euro cents).

There is a slight spelling error in Maartje's name: Maatrje -> Maartje. Can't blame you for that. Dutch names are not easy.