This repository was archived by the owner on Apr 18, 2025. It is now read-only.
NW6/Nohe-Tekelmariyam/J1-Modul-week-2#183
Open
nohetekelmariyam wants to merge 1 commit intoCodeYourFuture:mainfrom
Open
NW6/Nohe-Tekelmariyam/J1-Modul-week-2#183nohetekelmariyam wants to merge 1 commit intoCodeYourFuture:mainfrom
nohetekelmariyam wants to merge 1 commit intoCodeYourFuture:mainfrom
Conversation
varuna-v
reviewed
Dec 9, 2023
| // When we call this function with the weight and height | ||
| // Then it returns their Body Mass Index to 1 decimal place | ||
| function bmiCalculation(weight, height) { | ||
| if (typeof weight === "number" && typeof height === "number") { |
There was a problem hiding this comment.
Great to see you starting to think about input validation 👍
varuna-v
reviewed
Dec 9, 2023
| const wordJoin = wordToCapital.join("_"); | ||
| return wordJoin; | ||
| } | ||
| console.log(upperSnakeCase("nohe tekel mariyam")); |
There was a problem hiding this comment.
This solution gets you to the right answer, but there are a few inefficiencies.
- This code splits the input into its component words, and then loops through the words individually to convert them to upper case. Could you instead convert to upper case at a different point to eliminate the 'map' altogether?
- The steps here are split by space character and then join with underscore. How might you instead replaceAll the spaces with an underscore instead? What might be the benefit or downside of doing it that way?
varuna-v
reviewed
Dec 9, 2023
|
|
||
| // Come up with a clear, simple name for the function | ||
| // Use the string documentation to help you plan your solution | ||
| let string = ""; |
There was a problem hiding this comment.
What is the purpose of this line? Where is this variable used?
varuna-v
reviewed
Dec 9, 2023
| // Take this code and turn it into a reusable block of code. | ||
| // Declare a function called toPounds with an appropriately named parameter. | ||
| // Call this function a number of times to check it works for different inputs | ||
| function toPounds(penceString) { |
varuna-v
reviewed
Dec 9, 2023
| } | ||
| } | ||
| var price = 399; | ||
| console.log(productCostWithVat(price)); |
varuna-v
reviewed
Dec 9, 2023
| / //funtion pad(num) | ||
| //{ | ||
| // return num.toString().padstart(2,"0"); | ||
| //} No newline at end of file |
varuna-v
reviewed
Dec 9, 2023
|
|
||
| // b) What value is assigned to the parameter num when pad is called for the first time? | ||
|
|
||
| //remainingHours or 00 |
There was a problem hiding this comment.
00 would be the returned value of the method as you've correctly identified below. What value will be assigned to the parameter when the function is called?
|
Hi Nohe. Good work on the implement and interpret sections - you're demonstrating a clear grasp of these Javascript fundamentals 👏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.