-
-
Notifications
You must be signed in to change notification settings - Fork 50
NW6/Nohe-Tekelmariyam/J1-Modul-week-2 #183
base: main
Are you sure you want to change the base?
NW6/Nohe-Tekelmariyam/J1-Modul-week-2 #183
Conversation
@@ -13,3 +13,15 @@ | |||
// Given someone's weight in kg and height in metres | |||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see you starting to think about input validation 👍
const wordJoin = wordToCapital.join("_"); | ||
return wordJoin; | ||
} | ||
console.log(upperSnakeCase("nohe tekel mariyam")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
@@ -15,3 +15,11 @@ | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this line? Where is this variable used?
@@ -3,3 +3,20 @@ | |||
// 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍
} | ||
} | ||
var price = 399; | ||
console.log(productCostWithVat(price)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is right ✅
/ //funtion pad(num) | ||
//{ | ||
// return num.toString().padstart(2,"0"); | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right 👏
// Call formatTimeDisplay with an input of 143, now answer the following: | ||
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 👏 |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.