London 9 - Tony Arora - JavaScript-Core-1-Coursework-Week1 - #439
London 9 - Tony Arora - JavaScript-Core-1-Coursework-Week1#439Tony-devops wants to merge 14 commits into
Conversation
| @@ -1,3 +1,5 @@ | |||
| // Start by creating a variable `greeting` | |||
|
|
|||
| let greeting="Hello World" | |||
There was a problem hiding this comment.
Hi @Tony-devops ,
Generally, when you're writing a variable declaration like this, you need to add a ; at the end. ; is used to indicate the end of a statement in JS. Sometimes a ; can be omitted but it's generally good practice to put a ; at the end of statements.
There was a problem hiding this comment.
got it and same with sapcing. I need to shed the bad habits quickly. thanks
| @@ -1,3 +1,5 @@ | |||
| // Start by creating a variable `message` | |||
|
|
|||
| let first="My name is" | |||
There was a problem hiding this comment.
I'll let you update the formatting here yourself 😃
|
|
||
| let first="My name is" | ||
| let second=" King Tony" | ||
| let message=first + second |
There was a problem hiding this comment.
Don't forget your semi-colons on the end of these statements, too.
| @@ -1,3 +1,4 @@ | |||
| // Start by creating a variable `message` | |||
|
|
|||
| var name = "tony"; | |||
There was a problem hiding this comment.
At the moment, you're using var to declare a varibable. We probably need to update our exercises: however, whenever you're declaring a variable be sure to use the let or const keyword. You'll learn more about why this is the case later on in the course.
| @@ -1 +1,5 @@ | |||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | |||
| let numOfStudents=15; | |||
| let numOfMentors=8; | |||
There was a problem hiding this comment.
Same issue again with spaces. Make sure you come back and tweak these lines 😃
| let numOfMentors=8; | |
| let numOfMentors = 8; |
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| let numOfStudents=15; | ||
| let numOfMentors=8; | ||
| let abs=numOfMentors+numOfStudents; |
There was a problem hiding this comment.
How can you improve the readability of your code here ?
You've created a variable called abs but it's not immediately apparent to me what this means. Remember your code is not only read by a computer, but also by other people too! So remember to think carefully about your choice of variable names.
| @@ -1,5 +1,6 @@ | |||
| function halve(number) { | |||
| // complete the function here | |||
| return number/2 | |||
There was a problem hiding this comment.
Same issue with spacing applies here too - you can leave a space between number, the / and the 2.
| @@ -1,5 +1,6 @@ | |||
| function triple(number) { | |||
| // complete function here | |||
| return number*number*number | |||
| @@ -1,6 +1,7 @@ | |||
| // Complete the function so that it takes input parameters | |||
| function multiply() { | |||
| function multiply(a,b) { | |||
There was a problem hiding this comment.
As with the other statements, in a function declaration here it is also convention to place spaces between parameters:
| function multiply(a,b) { | |
| function multiply(a, b) { |
| // Write your function here | ||
|
|
||
| function createGreeting(name){ | ||
| return ("Nice to meet you " + name) |
There was a problem hiding this comment.
Here you've wrapped the return value in parentheses.
Do you need these parentheses in order for this function to work?
| function summed(a,b){ | ||
| return a+b | ||
| }; | ||
| let sum =summed(13,24) |
There was a problem hiding this comment.
summed is a cool variable name 😎. Can you explain why it is a good variable name in this context though?
|
|
||
| function convertToBRL() {} | ||
| function convertToBRL(brazil) { | ||
| let ninetyNine=(brazil*99)/100; |
There was a problem hiding this comment.
Let's think about how we can make this code even clearer.
You've created a variable to save the value after you've taken away 1%. But what about the expression - ninetyNine * 5.7 - what does this represent ? Could you store this expression in a variable and give it a name so it's clearer what exactly you're calculating.
Co-authored-by: MitchLloyd <[email protected]>
Co-authored-by: MitchLloyd <[email protected]>
| This function should expect to be called with any value which was returned by the shakeBall function. | ||
| */ | ||
| function checkAnswer(answer) { | ||
| function checkAnswer(string) { |
There was a problem hiding this comment.
Why did you change the name of this parameter from answer to string?
| //Write your code in here | ||
| for (let i=0; i<4;i++){ | ||
| let list=listsOfAnswers[i]; | ||
| for (let j = 0; j < 5; j++) { |
There was a problem hiding this comment.
Good attempt at variable naming here! A little wordy perhaps, but easier for me to work out what's going on in your code very quickly.
|
|
||
| function addTaxAndFormatCurrency() {} | ||
| function addTaxAndFormatCurrency(currency) { | ||
| let first=calculateSalesTax(currency); |
There was a problem hiding this comment.
Think about your indenting here - how can you update these variable declarations to make your code more readable. Also think about the naming of your variables here again. For example, what does the variable first mean ?
There was a problem hiding this comment.
Hi @Tony-devops,
I've just finished your review - sorry I didn't manage to finish it yesterday!
Well done on your first piece of JS Coursework!
I'm already seeing lots of good work here - good variable names and sound solutions to the exercises, including the extra exercises.
I think the main thing to focus on at the moment is your code formatting. If you fix this early on in the course it's going to make your life way easier :)
Well done!
|
Thank you for your email. Thanks again for the time taken to help me get
better.
I have taken the points on board and will ensure the spacing and the
semi-colon bad habit is nipped in the bud.
will make the necessary changes in the code.
thanks again
…On Thu, Dec 1, 2022 at 6:53 PM MitchLloyd ***@***.***> wrote:
***@***.**** commented on this pull request.
Hi @Tony-devops <https://github.com/Tony-devops>,
I've just finished your review - sorry I didn't manage to finish it
yesterday!
Well done on your first piece of JS Coursework!
I'm already seeing lots of good work here - good variable names and sound
solutions to the exercises, including the extra exercises.
I think the main thing to focus on the at the moment is your code
formatting. If you fix this early on in the course it's going to make your
life way easier :)
Well done!
—
Reply to this email directly, view it on GitHub
<#439 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2Q6657NFAEMMTUWUWRBBU3WLDXZHANCNFSM6AAAAAASKOAH24>
.
You are receiving this because you were mentioned.Message ID:
<CodeYourFuture/JavaScript-Core-1-Coursework-Week1/pull/439/review/1201514293
@github.com>
|
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? exercises and mandatory
What did you find hard? 8 ball
What do you still not understand? whether the 8 ball needed just whether the answer was between positive tonegative or all one random answer from the style of answer
Any other notes?