Giter VIP home page Giter VIP logo

hyf-javascript1's People

Contributors

meazer avatar

hyf-javascript1's Issues

Feedback homework week 2

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

You've done a great job here. Your code works correctly, is nicely formatted and your choice of variable names is excellent.

A couple of minor points.

1-stings.js

1. This file should actually be named strings.js.

2. Be consistent in your use of quotes as string delimiter. Either choose single quotes or double quotes and then stick to that for all of your code (I prefer single quotes myself).

2-arrays.js

3. This file is missing a 'use strict' line.

3-months.js

4. It is best to always use strict equality: use === instead of ==.

4-maartje.js

5. This file is missing a 'use strict' line.

Feedback homework week 3

Hi Meazer, here is my feedback on your homework for week 3.

Another excellent piece of work!

1-more.js

Correct!

2-more.js

Correct!

3-more.js

Correct! But note that the loop variable pro can be declared with const rather than let, as indicated by ESLint. You should use const wherever you can as it provides protection against inadvertent reassignment. Use let only when you intend to reassign the variable somewhere else in your code.

In general, you should follow up on all issues identified by ESLint. That's the whole point of ESLint: to give you warnings and errors where your code can (and should) be improved.

4-more.js

Correct! Nice that you used a switch statement here.

5-more.js

Correct!

6-more.js

Correct!

7-more.js

Correct!

This looks very much like a math relation:

iif ((0 < code) && (code <= vehicles.length)) {
//  0 < code <= vehicles.length

Most developers would write this as:

if (code > 0 && code <= vehicles.length) {

You don't need parentheses around the condition as the logical operator && has lower precedence than the comparison operators, but if they make the code more clear for you, no problem to leave them in.

You could move the vehicles array inside the function body so that your function becomes pure.

8-more.js

Correct! But the example in the assignment has no comma before the word 'and'. See my message in slack for alternative implementations.

9-more.js

Correct

10-more.js

Correct! I like the way you used a for loop to avoid having to use explicit numeric array indices.

11-more.js

Correct!

You don't need an else if the preceding if block always returns:

function equal(arr1, arr2) {
  if (arr1.length !== arr2.length) {
    return false;
  }
  for (let i = 0; i < arr1.length; i++) {
    if (arr1[i] !== arr2[i]) {
      return false;
    }
  }
  return true;
}

12-more.js

Correct!

13-more.js

Note that typeof is not a function; it is an operator. If it were a function you would have to use parentheses and supply it an argument. See MDN typeof.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.