Birmingham | ITP-Jan | Roman Sanaye | Sprint 2 | Module-Structuring-and-Testing-Data coursework#978
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Your solutions are all good, but several times you have left console.log calls within the function. Is this in line with best practices?
Sprint-2/1-key-errors/1.js
Outdated
| // =============> write your new code here | ||
| function convertToPercentage(decimalNumber) { | ||
| const percentage = `${decimalNumber * 100}%`; | ||
| console.log(`Your Decimal number will be ${percentage}.`); |
There was a problem hiding this comment.
Can you imagine any issues that might happen by including this console.log here inside the function?
Would you want it to always print to the console every time you run this function?
There was a problem hiding this comment.
Yes, I can see some issues. If console.log stays inside the function, it will print every time the function runs, which can clutter the console and make it harder to read important information. It is better to remove it or only use it for debugging.
| } No newline at end of file | ||
| let heightSquare = height * height; | ||
| let bmi = weight / heightSquare; | ||
| console.log(`Your BMI is ${bmi.toFixed(1)}`) |
There was a problem hiding this comment.
See my earlier comment. Leaving console.log statements inside functions might not be the best approach
There was a problem hiding this comment.
Yes, I understand. I have removed the console.log statements from the functions as it is better practice not to leave them in the final code.
| // This is the latest solution to the problem from the prep. | ||
| // Make sure to do the prep before you do the coursework | ||
| // Your task is to write tests for as many different groups of input data or edge cases as you can, and fix any bugs you find. | ||
| // --- > Debugging this code was not easy for me, I could solve this by the help of AI Explaining each step and conditions and finally we made it work well with different inputs, I mean string with number character. |
There was a problem hiding this comment.
Using AI to help at this stage can help you get a feel for the javascript, you might want to try doing this again by yourself - with no AI help - to make sure you learned the steps needed. For now though, the solution you have found works well.
There was a problem hiding this comment.
Thank you for your advice! I have written the function from scratch myself this time to make sure I understand all the steps. I will continue practicing without AI to improve further.
Thank you for your feedback! 😊 |
LonMcGregor
left a comment
There was a problem hiding this comment.
Great work on this task - it is complete now. I think you wanted a review, remember to add the "needs review" label in future after you have finished making updates to a PR
Learners, PR Template
Self checklist
Changelist
Reviewed and worked through all JS files in the following folders:
Made predictions, explained code, and debugged issues where needed
In 5-stretch-extend, handled edge cases in
formatAs12HourClock(midnight, noon, leading zeros) and added comprehensive testsAll files have been reviewed and tested; outputs are verified