NW5_Leeds_Shimaadnan_JavaScript_ First Week - #394
Conversation
Gevie
left a comment
There was a problem hiding this comment.
Great effort Shima, you did a good job, there is just some minor feedback for you to take a look at for this first week module.
| @@ -1 +1,3 @@ | |||
| //noconsole.log("Hello world"); | |||
There was a problem hiding this comment.
Hi Shima, we don't usually leave commented out code in our pull requests.
You can read more about it here :) https://syllabus.codeyourfuture.io/guides/code-style-guide#dont-leave-lots-of-commented-out-code
| @@ -5,6 +5,8 @@ We can use _variable_ to create a reference to a value. | |||
| ```js | |||
| var greeting = "Hello world"; | |||
There was a problem hiding this comment.
The exercises use var a lot so it's understandable that you would also use var. We encourage you to use let or const instead and never var.
- let - When a variable is assigned, its value can change
- const - When a variable is assigned, its value will never change, it is a constant.
We also don't need the ```js lines because this is more for markdown and will cause errors with your actual code.
Finally we only need the console.log(greeting); one time otherwise you say Hello World three times 👍
| @@ -1,3 +1,5 @@ | |||
| // Start by creating a variable `greeting` | |||
|
|
|||
| var greeting = "Hello World"; | |||
There was a problem hiding this comment.
The same feedback here Shima :) We only need the console.log one time and you can switch var greeting to const greeting 👍
| @@ -1,3 +1,4 @@ | |||
| // Start by creating a variable `message` | |||
|
|
|||
| let message = "This is a string"; | |||
There was a problem hiding this comment.
Brilliant work, this does exactly what is needed. The only comment would be to change let to const since we never change the value of message. Good job Shima.
| let greeting = "Hello, " | ||
| let myname = "My name is Shima" | ||
| let message = greeting + myname; | ||
| console.log(message); |
There was a problem hiding this comment.
Fantastic work, this does the job, again it's just changing let to const since you never change the values of each variable. 👍
|
|
||
| } | ||
| console.log(multiply(3,5,7)); | ||
| console.log(getStringLength("Hello I am working")); |
There was a problem hiding this comment.
Again, very well done on this exercise, you did it all correctly 👍 🥇
| console.log(trimWord(" CodeYourFuture ")); | ||
|
|
||
| function getStringLength(word) { | ||
| return word.length; |
There was a problem hiding this comment.
I would take notice on your indentation... at some points you indent by 2 spaces and at other points you indent by 4 spaces.
We have a guide on indentation here: https://syllabus.codeyourfuture.io/guides/code-style-guide#indent-your-code
| test("trimWord trims leading and trailing whitespace", () => { | ||
| expect(trimWord(" CodeYourFuture ")).toEqual("CodeYourFuture"); | ||
| }); | ||
| // test("trimWord trims leading and trailing whitespace", () => { |
There was a problem hiding this comment.
Hi Shima, we shouldn't be commenting out or modifying the test cases. These are here to ensure that your work passes the predefined tests.
Would you be able to undo this and restore it the way it was originally?
| } | ||
|
|
||
| //This function concatenate all the parameters which they can be string or numbers. | ||
| function concatenate(firstWord, secondWord, thirdWord) { |
There was a problem hiding this comment.
There seems to be a missing line here, I'm not sure why? It should have the following within the body of the function:
return firstWord.concat(' ', secondWord, ' ', thirdWord);It doesn't show in this code review but don't worry, your explanation is correct so we can just move on from here.
|
|
||
| function calculateSalesTax() {} | ||
| function calculateSalesTax(price) { | ||
| return price * 1.2; |
There was a problem hiding this comment.
Very well done Shima! I have seen some other solutions which were more complicated, you took a very simple approach and I like it :)
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?
View rendered exercises/C-variables/README.md