Skip to content
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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nohetekelmariyam
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@@ -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") {
Copy link

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"));
Copy link

@varuna-v varuna-v Dec 9, 2023

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.

  1. 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?
  2. 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 = "";
Copy link

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) {
Copy link

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));
Copy link

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");
//}
Copy link

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
Copy link

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?

@varuna-v
Copy link

varuna-v commented Dec 9, 2023

Hi Nohe. Good work on the implement and interpret sections - you're demonstrating a clear grasp of these Javascript fundamentals 👏
Did you have a go at the 'debug' and 'errors' tasks too? How did you find them?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants