From a54967b1b73cdf70a7b22dea8924b515a785ad79 Mon Sep 17 00:00:00 2001 From: abdullah1 Date: Tue, 28 Nov 2023 22:44:03 +0000 Subject: [PATCH] updateweek2 --- week-2/errors/0.js | 3 ++- week-2/errors/1.js | 3 +++ week-2/errors/2.js | 3 +++ week-2/implement/bmi.js | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/week-2/errors/0.js b/week-2/errors/0.js index 58b1349d..0bfedcc6 100644 --- a/week-2/errors/0.js +++ b/week-2/errors/0.js @@ -4,6 +4,7 @@ // interpret the error message and figure out why it's happening, if your prediction was wrong function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; + str = `${str[0].toUpperCase()}${str.slice(1)}`; return str; } + // variable name without let \ No newline at end of file diff --git a/week-2/errors/1.js b/week-2/errors/1.js index 14b5b511..2ff1de9a 100644 --- a/week-2/errors/1.js +++ b/week-2/errors/1.js @@ -11,3 +11,6 @@ function convertToPercentage(decimalNumber) { } console.log(decimalNumber); + // you can't declare constant with the same name as a parameter within the same scope + // decimalNumber is not defined. + // value numbers should not take string \ No newline at end of file diff --git a/week-2/errors/2.js b/week-2/errors/2.js index b0454133..036e38d4 100644 --- a/week-2/errors/2.js +++ b/week-2/errors/2.js @@ -5,6 +5,9 @@ function square(3) { return num * num; + console.log (square(3));//12 + console.log (square(6));//18 } + diff --git a/week-2/implement/bmi.js b/week-2/implement/bmi.js index 172c7c9a..c6013a67 100644 --- a/week-2/implement/bmi.js +++ b/week-2/implement/bmi.js @@ -13,3 +13,4 @@ // 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 +