Giter Site home page Giter Site logo

hyf-javascript1's People

Contributors

zersolo avatar

Watchers

 avatar

hyf-javascript1's Issues

Feedback homework week 3

Hi Solomon, here is my feedback on your JS1 week 3 homework.

There are some hints in your code that suggest to me that you still need to add some settings to your VSCode editor, specifically having to do with code formatting. Please check the VSCode Tips again and make sure the recommended settings are applied.

Step 4: Strings and Array challenges

  1. The .replace() method does not modify the string itself. Instead, it returns a new string. But you do not use this new string. Therefore, when you console.log(mystring); in line 9 still prints the string with commas. Didn't you see this when you tested your code?

  2. Using a for loop to find the index of meerkat is certainly a valid approach. However, there is a shorter way that most programmers use. You can use the .indexOf() array method, e.g.:

    const index = favoriteAnimals.indexOf('meerkat');
    if (index === -1) {
      console.log('There is no meerkat in this array');
    } else {
      'The item you are looking for is at index: ' + index);
    }

    There is a spelling error in line 15: 'turtule' -> 'turtle'.

More JavaScript

  1. There is no need to declare the variables a, b and c with a let statement. The lines 48-50 can be removed. These variables are unrelated to the parameters a, b and c of your function sum().

    There should not be a comma following the last parameter c in your function definition.

  2. As explained above, you can remove line 61. No need to declare variable carC.

    I assume that your variable carC stands for car color, but I'm only guessing. It is best to keep the guess work out of your code by choosing clear names. For instance, the simple name color probably best describes the purpose of this variable.

    You have a lot of comments in your code that do not really add value. For instance:

    colorCar('red');  // calling the function colorCar() with red color ;

    From the code it is already obvious that you are calling the function colorCar with the color red. You are just restating what you can already see from the code. Now, as you are just beginning I don't mind such comments, as they may help you to learn and understand your own code. Just keep in mind as you get more experienced that comments should not duplicate what should already be clear from the code.

  3. Functionally correct, but your code is not well-formatted. Please check the fundamental on Code Formatting how to format your code.

  4. You explain in your comment that cC means car color. Wouldn't it be more clear if you named that variable carColor (or simple color)? Then you wouldn't need the explanatory comment.

    Be consistent in your use of uppercase and lowercase letters. You have motorbike in lowercase, therefore use car instead of Car. Anyway, in normal English we use lowercase letters for nouns (except for proper nouns such as names of people, cities etc).

    Make sure that you correct spelling errors flagged in VSCode. Did you install the Spell Checker extension?

  5. Correct.

  6. You might want to try a nested if statement to avoid testing the same condition codeVehicle === 1 repeatedly. I give another approach in my solution of the homework I posted in slack.

    There should be a single space between words:

    a blue  Used Car
           ^ extra, unwanted space
    

    Parameter name cC -> color.

  7. Correct.

  8. Correct.

  9. In this exercise the code that you pass as parameter for the vehicle should be used as an index into the vehicleList array (but adjusted for the fact that arrays start at index zero). I'm afraid your code is rather confusing. Please refer to the solution I posted in slack on a possible way to implement this exercise.

  10. In the advertisement all vehicle types should be in the plural form (add an s to each vehicle name). We did not ask the vehicles to be in uppercase.

    Why do you append a separate, single space after service? You could simply add that space at the end of the first string. Also, be consistent in your use of quotes. Choose one type of quote (single or double) and use it consistently throughout your code. Don't mix them.

  11. While you have added a 'truck' your 'bike' is now missing from the advertisement.

  12. I do not see your empty object.

  13. Exercises 13 and 14 are separate, where 14 builds upon the result of 13. Check the solution I posted in slack.

  14. See 13.

  15. Correct.

  16. Correct.

  17. Correct.

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.