Skip to content

Feedback JS Homework Week 2 #1

@remarcmij

Description

@remarcmij

Hi Fayez, here is my feedback on your homework.

In general: please use let and 'constinsteadvar`.

Q1. Your are missing a let in your for statement:

for (let i = 0; i < arguments.length; i++ ) {

You are actually overdelivering in your solution. I would have accepted the following too:

function sum(x, y, z) {
	return x + y + z;
}

Q2. Except for in very special cases your variable and function names should be in camelCase. Examples: colorCar, barcelona, listOfVehices, etc.

If you have installed the spell checker in VSCode you might have noticed that beatiful had a green underline because of a spelling mistake.

Except for that (and the name that needs to be camelCase), your code works fine.

Q3. You created an array rather than an object.

Q4. Excellent

Q5. It is better to always use 'strict' equality: ===.

Q6. I don't see anything here.

Q7. Use let or const and a camelCase name. Be consistent with using uppercase and lowercase in the values of your array. If you want to start each vehicle type with an uppercase letter then car should be Car.

Q8. OK

Q9. The assignment requires that your function should take three arguments:

function vehicle(color, type, age) {
  ...
}

and be called like this:

vehicle("blue", 1, 5)

It should produce this output:

a blue used car

Can you make it work like that?

Q10. Your output is:

The best Garage, we service a  car, motorbike, bike, caravan,

There are two spaces before 'car' instead of one. The comma between 'bike' and 'caravan' should be replaced with the word 'and'. The comma after 'caravan' should be a .

Your code goes in the right direction but needs a bit more tweaking to get the correct output.

Q11. I didn't see how you added a new vehicle type and used it without changing your function.

Q12. I didn't see your empty object.

Q13. I would expect something like this:

const teachers = [
	{name: 'Jim'},
	{name: 'Philip'},
	...
];

Q14. Taking the object from Q13 you could now add a new property, language:

const teachers = [
	{name: 'Jim', language: 'JS'},
	{name: 'Philip', language: 'HTML'},
	...
];

Q15. In your function foo you should not call bar. You should only use the func argument.

Q16. What is your conclusion if you look at the output?

Q17. If, instead of doing this:

o2 = { foo: 'not bar' };

you would do:

o2.foo = 'not bar';

How would that change things?

Q18. What conclusion can you draw?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions