From 3c0525b192ce919e9f482b54fa0e812ff0a96639 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Thu, 3 Jul 2025 00:43:46 +0100 Subject: [PATCH 01/27] add comment on the last line of file 1-count.js --- Sprint-1/1-key-exercises/1-count.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6..4df73a5a8 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,4 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing +// what line 3 doing is add 1 to current value of "count" and saving or assigning the new value (which is 1) as new value From 168186a8b853bfdf87e55dbf554ffff80b8f5863 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Thu, 3 Jul 2025 00:49:28 +0100 Subject: [PATCH 02/27] add console.log() to verify the value of count --- Sprint-1/1-key-exercises/1-count.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 4df73a5a8..4e1456937 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,4 +4,7 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing + +console.log(`value of count is ${count}`) + // what line 3 doing is add 1 to current value of "count" and saving or assigning the new value (which is 1) as new value From 72645b88c0d28e73b1845975bd459297ab2ba9e0 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Thu, 3 Jul 2025 01:04:44 +0100 Subject: [PATCH 03/27] add function getInitial in 2-initials.js and print to verify --- Sprint-1/1-key-exercises/2-initials.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f617..972c09647 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -9,3 +9,9 @@ let initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn +function getInitial(firstName, middleName, lastName) { + return firstName[0] + middleName[0] + lastName[0]; +} + +initials = getInitial("Creola", "Katherine", "Johnson"); +console.log(`initials is ${initials}`); From 006df3def334e104bd619042b8320743e636bf7c Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:27:08 +0100 Subject: [PATCH 04/27] solve exercise sprint1/3-paths.js --- Sprint-1/1-key-exercises/3-paths.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index ab90ebb28..e713897e6 100644 --- a/Sprint-1/1-key-exercises/3-paths.js +++ b/Sprint-1/1-key-exercises/3-paths.js @@ -17,7 +17,11 @@ console.log(`The base part of ${filePath} is ${base}`); // Create a variable to store the dir part of the filePath variable // Create a variable to store the ext part of the variable -const dir = ; -const ext = ; +const dir = filePath.slice(1, lastSlashIndex); +console.log(dir); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +const dotIndex = base.lastIndexOf("."); +const ext = base.slice(dotIndex + 1); +console.log(ext); + +// https://www.google.com/search?q=slice+mdn From 998a7ee7bb555ef489ba78bce8adafc8fa2e7f60 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:37:26 +0100 Subject: [PATCH 05/27] comment and study exercise sprint-1/4-random.js --- Sprint-1/1-key-exercises/4-random.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-1/1-key-exercises/4-random.js b/Sprint-1/1-key-exercises/4-random.js index 292f83aab..e099d1731 100644 --- a/Sprint-1/1-key-exercises/4-random.js +++ b/Sprint-1/1-key-exercises/4-random.js @@ -5,5 +5,11 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // In this exercise, you will need to work out what num represents? // Try breaking down the expression and using documentation to explain what it means + +//Math.random() -> generates zero base random number +// we need to multiply with digit number needed to allow possible number generated +//Math.floor() method will round up to the base integer generated + // It will help to think about the order in which expressions are evaluated // Try logging the value of num and running the program several times to build an idea of what the program is doing +console.log(num); From 63a8de0c99f0a9f51589f948f3adb19cfe2f2999 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:39:27 +0100 Subject: [PATCH 06/27] solve exec. sprint1/mandatory-errors/0.js --- Sprint-1/2-mandatory-errors/0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/0.js b/Sprint-1/2-mandatory-errors/0.js index cf6c5039f..e6b744a05 100644 --- a/Sprint-1/2-mandatory-errors/0.js +++ b/Sprint-1/2-mandatory-errors/0.js @@ -1,2 +1,2 @@ -This is just an instruction for the first activity - but it is just for human consumption -We don't want the computer to run these 2 lines - how can we solve this problem? \ No newline at end of file +//This is just an instruction for the first activity - but it is just for human consumption +//We don't want the computer to run these 2 lines - how can we solve this problem? From 04cb87218bf6b5c97225a5bf7cbbfcf45eef318e Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:42:20 +0100 Subject: [PATCH 07/27] study exec. sprint-1/2-mandatory-errors/1.js --- Sprint-1/2-mandatory-errors/1.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-1/2-mandatory-errors/1.js b/Sprint-1/2-mandatory-errors/1.js index 7a43cbea7..41e7f21a4 100644 --- a/Sprint-1/2-mandatory-errors/1.js +++ b/Sprint-1/2-mandatory-errors/1.js @@ -1,4 +1,7 @@ // trying to create an age variable and then reassign the value by 1 +//create variable age const age = 33; + +//reassign variable age by 1 (+1) age = age + 1; From 55aaa5f6f9f796c204239f2a69c303fb125be7ec Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:45:50 +0100 Subject: [PATCH 08/27] solve exec. sprint-1/2-mandatory-errors/2.js --- Sprint-1/2-mandatory-errors/2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index e09b89831..d64dd7525 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,5 +1,8 @@ // Currently trying to print the string "I was born in Bolton" but it isn't working... // what's the error ? -console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; +console.log(`I was born in ${cityOfBirth}`); + +//it's not working because variable cityOfBirth was not defined. +//change the position of -- const cityOfBirth = "Bolton"; -- before the logging will fix the problem From c1d37450f9fe6b66137cf7566be084fad5462271 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 22:54:34 +0100 Subject: [PATCH 09/27] solve exec. sprint-1/2-mandatory-errors/3.js --- Sprint-1/2-mandatory-errors/3.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index ec101884d..ad181e425 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -1,9 +1,13 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const cardNumberStr = cardNumber.toString(); +const last4Digits = cardNumberStr.slice(-4); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working // Before running the code, make and explain a prediction about why the code won't work // Then run the code and see what error it gives. +console.log(last4Digits); // Consider: Why does it give this error? Is this what I predicted? If not, what's different? +//can not slice a number, the given card number is integer NOT a List or array // Then try updating the expression last4Digits is assigned to, in order to get the correct value +//fix by give double quotes to turn the number to sting or make a new variable assign cardNumber.toString() From a4496e3c116f5030ab4af82b02588dcded2d2905 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 23:05:40 +0100 Subject: [PATCH 10/27] solve exec. sprint-1/2-mandatory-errors/4.js --- Sprint-1/2-mandatory-errors/4.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/4.js b/Sprint-1/2-mandatory-errors/4.js index 21dad8c5d..95482db73 100644 --- a/Sprint-1/2-mandatory-errors/4.js +++ b/Sprint-1/2-mandatory-errors/4.js @@ -1,2 +1,5 @@ -const 12HourClockTime = "20:53"; -const 24hourClockTime = "08:53"; \ No newline at end of file +const ClockTime_12Hour = "20:53"; +const ClockTime_24hour = "08:53"; + +//variable name convention issues... +//variable name should not started a number From 13835fb3a77baaae35ace48b78be0e4636d6b073 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 23:20:03 +0100 Subject: [PATCH 11/27] solve exec. sprint-1/3-mandatory-interpret/1-percentage-change.js --- .../3-mandatory-interpret/1-percentage-change.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/1-percentage-change.js b/Sprint-1/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..1099d0ad4 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/3-mandatory-interpret/1-percentage-change.js @@ -2,7 +2,7 @@ let carPrice = "10,000"; let priceAfterOneYear = "8,543"; carPrice = Number(carPrice.replaceAll(",", "")); -priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); +priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); const priceDifference = carPrice - priceAfterOneYear; const percentageChange = (priceDifference / carPrice) * 100; @@ -12,11 +12,13 @@ console.log(`The percentage change is ${percentageChange}`); // Read the code and then answer the questions below // a) How many function calls are there in this file? Write down all the lines where a function call is made - +//------->ans: build-in function call line numbers 4,5 and 10 // b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem? - +//------->ans: error at line 5. +//------->ans: add a missing comma // c) Identify all the lines that are variable reassignment statements - +//------->ans: line 4 (carPrice) and line 5 (priceAfterOneYear) // d) Identify all the lines that are variable declarations - +//------->and: line 1 and 2 // e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +//------->and: replace character comma with nothing or in other words remove it or delete it From 4bc0b4b4aec32bb34718769b51aace993fdaf0d4 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 23:33:54 +0100 Subject: [PATCH 12/27] solve exec. sprint-1/3-mandatory-interpret/2.js --- Sprint-1/3-mandatory-interpret/2-time-format.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 47d239558..9ede9ef5b 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -12,14 +12,14 @@ console.log(result); // For the piece of code above, read the code and then answer the following questions // a) How many variable declarations are there in this program? - +//------->ans: 6 // b) How many function calls are there? - +//------->ans: 1 at the last line, that is console.log() .. it is a built-in function. // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators - +//------->ans: The remainder (%) operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend. // d) Interpret line 4, what does the expression assigned to totalMinutes mean? - +//------->ans: (movieLength - remainingSeconds) / 60; // e) What do you think the variable result represents? Can you think of a better name for this variable? - +// // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer From e678b92fb7307800b0b5d57c0f8052e1af66a1f2 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 23:45:47 +0100 Subject: [PATCH 13/27] update solution 2-time-format.js --- Sprint-1/3-mandatory-interpret/2-time-format.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 9ede9ef5b..7826fcca8 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -1,4 +1,4 @@ -const movieLength = 8784; // length of movie in seconds +const movieLength = 86401; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -21,5 +21,6 @@ console.log(result); // d) Interpret line 4, what does the expression assigned to totalMinutes mean? //------->ans: (movieLength - remainingSeconds) / 60; // e) What do you think the variable result represents? Can you think of a better name for this variable? -// +//------->ans: it generates a number in "seconds", for selection of name? the selected one is fine. as long as it follows the variable names convention and the reader or debugger easily understand it. // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +//------->ans: it has a constrain or maybe limitation, that is if value movie length is bigger that 86400 the time shown not appropriate, it should give a hint that it more than a day From a5cd1c577712d03704486c4cb748ae69e6b932cc Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sat, 5 Jul 2025 23:57:57 +0100 Subject: [PATCH 14/27] comment out sprint-1/3-mandatory-interpret/3-to-pounds.js --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..29b72fd4e 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -1,19 +1,24 @@ -const penceString = "399p"; +const penceString = "9p"; //init variable const penceStringWithoutTrailingP = penceString.substring( 0, penceString.length - 1 -); +); //remove p character at the end of the variable +console.log(penceStringWithoutTrailingP); + +const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // +console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits. -const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2 -); +); //get ponds value conversion changes for given pence + +console.log(pounds); const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) - .padEnd(2, "0"); + .padEnd(2, "0"); //get the reminds after conversion to pounds console.log(`£${pounds}.${pence}`); From 1f7f9e200a892c69efe10480fd23072799511420 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sun, 6 Jul 2025 00:10:30 +0100 Subject: [PATCH 15/27] tried sprint-1/4-stretch-explore/chrome.md --- Sprint-1/4-stretch-explore/chrome.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index e7dd5feaf..6356d05d2 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -1,6 +1,6 @@ Open a new window in Chrome, -then locate the **Console** tab. +then locate the **Console** tab. (short cut for linux ctrl+shift+j) Voila! You now have access to the [Chrome V8 Engine](https://www.cloudflare.com/en-gb/learning/serverless/glossary/what-is-chrome-v8/). Just like the Node REPL, you can input JavaScript code into the Console tab and the V8 engine will execute it. @@ -9,10 +9,16 @@ Let's try an example. In the Chrome console, invoke the function `alert` with an input string of `"Hello world!"`; +ans: done! What effect does calling the `alert` function have? +ans: pops out a message with given strings inside alert arguments Now try invoking the function `prompt` with a string input of `"What is your name?"` - store the return value of your call to `prompt` in an variable called `myName`. +ans: myname = prompt("What is your name?"); What effect does calling the `prompt` function have? +ans: pops out a message with input field and we can store the input value into a variable + What is the return value of `prompt`? +ans: return value is the string given by user From a8546b9b12a19261d138999904949a2039fbd0a0 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Sun, 6 Jul 2025 00:21:42 +0100 Subject: [PATCH 16/27] study and comment out sprint-1/4-mandatory-explore/objects.md --- Sprint-1/4-stretch-explore/objects.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Sprint-1/4-stretch-explore/objects.md b/Sprint-1/4-stretch-explore/objects.md index 0216dee56..52c71625b 100644 --- a/Sprint-1/4-stretch-explore/objects.md +++ b/Sprint-1/4-stretch-explore/objects.md @@ -3,14 +3,17 @@ In this activity, we'll explore some additional concepts that you'll encounter in more depth later on in the course. Open the Chrome devtools Console, type in `console.log` and then hit enter +ans: done! What output do you get? - +ans: undefined Now enter just `console` in the Console, what output do you get back? - +ans: a list of available methods for console. Try also entering `typeof console` - +ans: done! Answer the following questions: - +ans: object What does `console` store? What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? +ans: console.log() will print given parameter in it, +console.assert(, ) only print out the given comment if expression inside it is fault or false From 65e1a8ee32f09873b9ffbff8ea7fbf4ba211076c Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 21:30:52 +0100 Subject: [PATCH 17/27] end of Sprit-1 --- Sprint-2/1-key-errors/0.js | 12 +++- Sprint-2/1-key-errors/1.js | 13 +++- Sprint-2/1-key-errors/2.js | 17 +++-- Sprint-2/2-mandatory-debug/0.js | 18 ++++-- Sprint-2/2-mandatory-debug/1.js | 20 ++++-- Sprint-2/2-mandatory-debug/2.js | 33 +++++++--- Sprint-2/3-mandatory-implement/1-bmi.js | 16 ++++- Sprint-2/3-mandatory-implement/2-cases.js | 14 +++++ Sprint-2/3-mandatory-implement/3-to-pounds.js | 63 +++++++++++++++++++ 9 files changed, 176 insertions(+), 30 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a0..e10d77121 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,13 +1,21 @@ // Predict and explain first... // =============> write your prediction here +//the function will turn the first given string into Uppercase. // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; - return str; + let strWithUpperCase = `${str[0].toUpperCase()}${str.slice(1)}`; + return strWithUpperCase; } // =============> write your explanation here +// str[0].toUpperCase() ---> gets the first character and uses build-in method to convert a char to uppercase +// str.slice(1) ----> will slice the array or sting "start from 1" to the rest of array or string +// we get an error because we "re-declare" the str variable as parameter and as call back of expression + // =============> write your new code here + +const myStr = "i forgot add this string"; +console.log(capitalise(myStr)); diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f..73c966172 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,17 +2,24 @@ // Why will an error occur when this program runs? // =============> write your prediction here - +// decimalNumber variable was declared twice. First as parameter and second as const in function body +// use different variable name, either in parameter or the one in function body. +// any way this function always return the same value because the variable is constant and define inside th function, +// usually a function take a variable from function parameters. +// console.log() will fail to print because no parameter define first. // Try playing computer with the example to work out what is going on function convertToPercentage(decimalNumber) { - const decimalNumber = 0.5; + //-----> should be place as parameter and not as a constant ,,,,,const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(decimalNumber); +decimalNumber = 0.27; + +console.log(decimalNumber); //this is fine, just define the parameter it needs. +console.log(convertToPercentage(decimalNumber)); // =============> write your explanation here diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cf..cab86aaf8 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -1,20 +1,27 @@ - // Predict and explain first BEFORE you run any code... // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here +//the function will return square for every given number. -function square(3) { - return num * num; -} +// function square(3) { +// return num * num; +// } // =============> write the error message here +// ans: Unexpected number // =============> explain this error message here - +// ans: function need num to be defined, instead parameter was given 3 as literal value that does not point to any variable as parameter // Finally, correct the code to fix the problem // =============> write your new code here +function square(num) { + return num * num; +} + +mynum = 3; //define the num +console.log(square(mynum)); //verify the result diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b41..cae15f4e6 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,14 +1,20 @@ // Predict and explain first... // =============> write your prediction here +// function will return with result of multiplication of given parameters (i,e: a times b) +// function multiply(a, b) { +// console.log(a * b); +// } -function multiply(a, b) { - console.log(a * b); -} - -console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); +// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); // =============> write your explanation here - +// the function does not return any thing, so as result ${multiply(10, 32)} --> will return as "undefined" // Finally, correct the code to fix the problem // =============> write your new code here + +function multiply(a, b) { + return a * b; +} + +console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcf..71133ca6f 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,13 +1,23 @@ // Predict and explain first... // =============> write your prediction here +// sure this function wont work because, hang on.. I should predict and pretend that everything is fine +// the function will return with summary of given parameters and console.log will verify it -function sum(a, b) { - return; - a + b; -} +// function sum(a, b) { +// return; +// a + b; +// } -console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); +// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here +//function will execute line the code and escape from the function block whenever it "sees" return.. it will return with any expression put on it +// in this function a+b which is expected as the result is placed after return line because return has ";" so i wont bother look the next line. +// just remove the semicolon next to the return.. and put a+b instead, because some how "prettier" as trusty worthy formatter for this course will always add extra ; for every logical expression (somehow).. :) xixixixi // Finally, correct the code to fix the problem // =============> write your new code here +function sum(a, b) { + return a + b; +} + +console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc3..df9a69b35 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,23 +2,42 @@ // Predict the output of the following code: // =============> Write your prediction here +// alright! from the sake of the function name, I can predict that it will successfully get the last digit +// oh hang-on, where is the parameter???? this programmer must be tired or "coding while eating"... careful aye.. holiday is coming. -const num = 103; +// const num = 103; -function getLastDigit() { - return num.toString().slice(-1); -} +// function getLastDigit() { +// return num.toString().slice(-1); +// } -console.log(`The last digit of 42 is ${getLastDigit(42)}`); -console.log(`The last digit of 105 is ${getLastDigit(105)}`); -console.log(`The last digit of 806 is ${getLastDigit(806)}`); +// console.log(`The last digit of 42 is ${getLastDigit(42)}`); +// console.log(`The last digit of 105 is ${getLastDigit(105)}`); +// console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction // =============> write the output here +// nope.. It runs as predicted :) xixixiixi... that way we are in this "debugging" session. +// it runs but no syntax error but the output are not correct. + // Explain why the output is the way it is // =============> write your explanation here +// the function does not get any "define parameter", like nothing, so it tries to the "num" in global variable +// that is given just before the function that is const num = 103; +// so, every time that function is called, it will use num 103 as parameter + // Finally, correct the code to fix the problem // =============> write your new code here +const num = 103; + +function getLastDigit(num) { + return num.toString().slice(-1); +} + +console.log(`The last digit of 42 is ${getLastDigit(42)}`); +console.log(`The last digit of 105 is ${getLastDigit(105)}`); +console.log(`The last digit of 806 is ${getLastDigit(806)}`); // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem +// no syntax error just logic error :) because, sometime we need to manipulate the function just like that. BTW that is not save anyway. diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1..7e03d5887 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,5 +15,17 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - // return the BMI of someone based off their weight and height -} \ No newline at end of file + // squaring your height: 1.73 x 1.73 = 2.99 + let heightSquared = height * height; + // dividing 70 by 2.99 = 23.41 + let weightMod = weight / heightSquared; + // Your result will be displayed to 1 decimal place, for example 23.4. + let BMI = weightMod.toFixed(1); + // return the BMI of someone based off their weight and height + return BMI; +} + +let myWeight = 70; +let myHeight = 1.73; + +console.log(`my BMI is ${calculateBMI(myWeight, myHeight)}`); diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad..bc290d6e0 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,17 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase + +let myStr = "hello world I am sleepy"; + +// let myStrUpperCase = myStr.toUpperCase(); + +// let arrWord = myStrUpperCase.split(" "); + +// let myStrUpperCaseWithSnakeCase = arrWord.join("_"); + +//console.log(`${arrWord}`); + +let combine = myStr.toUpperCase().split(" ").join("_"); + +console.log(`${combine}`); diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a70..781aacc33 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,66 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs + +//============================================================= +// const penceString = "9p"; //init variable + +// const penceStringWithoutTrailingP = penceString.substring( +// 0, +// penceString.length - 1 +// ); //remove p character at the end of the variable +// console.log(penceStringWithoutTrailingP); + +// const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // +// console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits. + +// const pounds = paddedPenceNumberString.substring( +// 0, +// paddedPenceNumberString.length - 2 +// ); //get ponds value conversion changes for given pence + +// console.log(pounds); + +// const pence = paddedPenceNumberString +// .substring(paddedPenceNumberString.length - 2) +// .padEnd(2, "0"); //get the reminds after conversion to pounds + +// console.log(`£${pounds}.${pence}`); + +//------------------------------------------------------------------------------------------ + +function pensToPounds(penceString) { + const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 + ); //remove p character at the end of the variable + //console.log(penceStringWithoutTrailingP); + + const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // + //console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits. + + const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 + ); //get ponds value conversion changes for given pence + + //console.log(pounds); + + const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); //get the reminds after conversion to pounds + + return `£${pounds}.${pence}`; +} + +//test----1 +let moneyA = "90p"; +console.log(`${pensToPounds(moneyA)}`); + +//test----2 +moneyA = "710p"; +console.log(`${pensToPounds(moneyA)}`); + +//test----3 +moneyA = "1210p"; +console.log(`${pensToPounds(moneyA)}`); From 100b9fd4884b2e661b6ece7ee6c19ed3d438539d Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 22:56:38 +0100 Subject: [PATCH 18/27] reset to origin file Sprint-2/1-key-errors/0.js --- Sprint-2/1-key-errors/0.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index e10d77121..653d6f5a0 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,21 +1,13 @@ // Predict and explain first... // =============> write your prediction here -//the function will turn the first given string into Uppercase. // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring function capitalise(str) { - let strWithUpperCase = `${str[0].toUpperCase()}${str.slice(1)}`; - return strWithUpperCase; + let str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; } // =============> write your explanation here -// str[0].toUpperCase() ---> gets the first character and uses build-in method to convert a char to uppercase -// str.slice(1) ----> will slice the array or sting "start from 1" to the rest of array or string -// we get an error because we "re-declare" the str variable as parameter and as call back of expression - // =============> write your new code here - -const myStr = "i forgot add this string"; -console.log(capitalise(myStr)); From 95efc716ca53fd39ccd7ced69faf48a68554341a Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 22:59:35 +0100 Subject: [PATCH 19/27] reset file Sprint-2/1-key-errors/1.js --- Sprint-2/1-key-errors/1.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index 73c966172..f2d56151f 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,24 +2,17 @@ // Why will an error occur when this program runs? // =============> write your prediction here -// decimalNumber variable was declared twice. First as parameter and second as const in function body -// use different variable name, either in parameter or the one in function body. -// any way this function always return the same value because the variable is constant and define inside th function, -// usually a function take a variable from function parameters. -// console.log() will fail to print because no parameter define first. + // Try playing computer with the example to work out what is going on function convertToPercentage(decimalNumber) { - //-----> should be place as parameter and not as a constant ,,,,,const decimalNumber = 0.5; + const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -decimalNumber = 0.27; - -console.log(decimalNumber); //this is fine, just define the parameter it needs. -console.log(convertToPercentage(decimalNumber)); +console.log(decimalNumber); // =============> write your explanation here From ce9e5c1d14436bc702eb3d153c4ea8a1dff7036f Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:01:23 +0100 Subject: [PATCH 20/27] reset Sprint-2/1-key-errors/2.js --- Sprint-2/1-key-errors/2.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index cab86aaf8..84cc80243 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -1,27 +1,18 @@ + // Predict and explain first BEFORE you run any code... // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here -//the function will return square for every given number. -// function square(3) { -// return num * num; -// } +function square(3) { + return num * num; +} // =============> write the error message here -// ans: Unexpected number // =============> explain this error message here -// ans: function need num to be defined, instead parameter was given 3 as literal value that does not point to any variable as parameter -// Finally, correct the code to fix the problem - -// =============> write your new code here -function square(num) { - return num * num; -} - -mynum = 3; //define the num +// Finally, correct the code to fix the problem -console.log(square(mynum)); //verify the result +// =============> write your new code here \ No newline at end of file From a638efe9ab44493fd7c891740d2d12bd936727a7 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:03:18 +0100 Subject: [PATCH 21/27] reset file Sprint-2/2-mandatory-debug/0.js --- Sprint-2/2-mandatory-debug/0.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index cae15f4e6..b27511b41 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,20 +1,14 @@ // Predict and explain first... // =============> write your prediction here -// function will return with result of multiplication of given parameters (i,e: a times b) -// function multiply(a, b) { -// console.log(a * b); -// } - -// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); - -// =============> write your explanation here -// the function does not return any thing, so as result ${multiply(10, 32)} --> will return as "undefined" -// Finally, correct the code to fix the problem -// =============> write your new code here function multiply(a, b) { - return a * b; + console.log(a * b); } console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); + +// =============> write your explanation here + +// Finally, correct the code to fix the problem +// =============> write your new code here From 5ae319da0b0a624f1958a60456aa6f9afd210a5a Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:04:38 +0100 Subject: [PATCH 22/27] reset file Sprint-2/2-mandatory-debug/1.js --- Sprint-2/2-mandatory-debug/1.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 71133ca6f..37cedfbcf 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,23 +1,13 @@ // Predict and explain first... // =============> write your prediction here -// sure this function wont work because, hang on.. I should predict and pretend that everything is fine -// the function will return with summary of given parameters and console.log will verify it -// function sum(a, b) { -// return; -// a + b; -// } +function sum(a, b) { + return; + a + b; +} -// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); +console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here -//function will execute line the code and escape from the function block whenever it "sees" return.. it will return with any expression put on it -// in this function a+b which is expected as the result is placed after return line because return has ";" so i wont bother look the next line. -// just remove the semicolon next to the return.. and put a+b instead, because some how "prettier" as trusty worthy formatter for this course will always add extra ; for every logical expression (somehow).. :) xixixixi // Finally, correct the code to fix the problem // =============> write your new code here -function sum(a, b) { - return a + b; -} - -console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); From f45625eff832b7f7193593f4288ffdb1d6da1b5e Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:06:34 +0100 Subject: [PATCH 23/27] reset file Sprint-2/2-mandatory-errors/2.js --- Sprint-2/2-mandatory-debug/2.js | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index df9a69b35..57d3f5dc3 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,42 +2,23 @@ // Predict the output of the following code: // =============> Write your prediction here -// alright! from the sake of the function name, I can predict that it will successfully get the last digit -// oh hang-on, where is the parameter???? this programmer must be tired or "coding while eating"... careful aye.. holiday is coming. -// const num = 103; +const num = 103; -// function getLastDigit() { -// return num.toString().slice(-1); -// } +function getLastDigit() { + return num.toString().slice(-1); +} -// console.log(`The last digit of 42 is ${getLastDigit(42)}`); -// console.log(`The last digit of 105 is ${getLastDigit(105)}`); -// console.log(`The last digit of 806 is ${getLastDigit(806)}`); +console.log(`The last digit of 42 is ${getLastDigit(42)}`); +console.log(`The last digit of 105 is ${getLastDigit(105)}`); +console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction // =============> write the output here -// nope.. It runs as predicted :) xixixiixi... that way we are in this "debugging" session. -// it runs but no syntax error but the output are not correct. - // Explain why the output is the way it is // =============> write your explanation here -// the function does not get any "define parameter", like nothing, so it tries to the "num" in global variable -// that is given just before the function that is const num = 103; -// so, every time that function is called, it will use num 103 as parameter - // Finally, correct the code to fix the problem // =============> write your new code here -const num = 103; - -function getLastDigit(num) { - return num.toString().slice(-1); -} - -console.log(`The last digit of 42 is ${getLastDigit(42)}`); -console.log(`The last digit of 105 is ${getLastDigit(105)}`); -console.log(`The last digit of 806 is ${getLastDigit(806)}`); // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem -// no syntax error just logic error :) because, sometime we need to manipulate the function just like that. BTW that is not save anyway. From d8f561b50dce9628be389d3dbd1c03a4183597dc Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:08:57 +0100 Subject: [PATCH 24/27] reset file Sprint-2/3-mandatory-implement/1-bmi.js --- Sprint-2/3-mandatory-implement/1-bmi.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 7e03d5887..ef2072b50 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,17 +15,5 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - // squaring your height: 1.73 x 1.73 = 2.99 - let heightSquared = height * height; - // dividing 70 by 2.99 = 23.41 - let weightMod = weight / heightSquared; - // Your result will be displayed to 1 decimal place, for example 23.4. - let BMI = weightMod.toFixed(1); // return the BMI of someone based off their weight and height - return BMI; } - -let myWeight = 70; -let myHeight = 1.73; - -console.log(`my BMI is ${calculateBMI(myWeight, myHeight)}`); From 08290c64da59bd8ff97b0510e57551290083decd Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:10:44 +0100 Subject: [PATCH 25/27] reset file Sprint-2/2-mandatory-implement/2-cases.js --- Sprint-2/3-mandatory-implement/2-cases.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index bc290d6e0..5b0ef77ad 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,17 +14,3 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase - -let myStr = "hello world I am sleepy"; - -// let myStrUpperCase = myStr.toUpperCase(); - -// let arrWord = myStrUpperCase.split(" "); - -// let myStrUpperCaseWithSnakeCase = arrWord.join("_"); - -//console.log(`${arrWord}`); - -let combine = myStr.toUpperCase().split(" ").join("_"); - -console.log(`${combine}`); From 3bb0a7c1284f0c59067b636b5c9075f83de661ba Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Mon, 7 Jul 2025 23:12:07 +0100 Subject: [PATCH 26/27] reset file Sprint-2/2-mandatory-implement/3-to-pounds.js --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 63 ------------------- 1 file changed, 63 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 781aacc33..6265a1a70 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,66 +4,3 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs - -//============================================================= -// const penceString = "9p"; //init variable - -// const penceStringWithoutTrailingP = penceString.substring( -// 0, -// penceString.length - 1 -// ); //remove p character at the end of the variable -// console.log(penceStringWithoutTrailingP); - -// const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // -// console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits. - -// const pounds = paddedPenceNumberString.substring( -// 0, -// paddedPenceNumberString.length - 2 -// ); //get ponds value conversion changes for given pence - -// console.log(pounds); - -// const pence = paddedPenceNumberString -// .substring(paddedPenceNumberString.length - 2) -// .padEnd(2, "0"); //get the reminds after conversion to pounds - -// console.log(`£${pounds}.${pence}`); - -//------------------------------------------------------------------------------------------ - -function pensToPounds(penceString) { - const penceStringWithoutTrailingP = penceString.substring( - 0, - penceString.length - 1 - ); //remove p character at the end of the variable - //console.log(penceStringWithoutTrailingP); - - const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); // - //console.log(paddedPenceNumberString); //give format of 3 zeroes if the number is less than 3 digits. - - const pounds = paddedPenceNumberString.substring( - 0, - paddedPenceNumberString.length - 2 - ); //get ponds value conversion changes for given pence - - //console.log(pounds); - - const pence = paddedPenceNumberString - .substring(paddedPenceNumberString.length - 2) - .padEnd(2, "0"); //get the reminds after conversion to pounds - - return `£${pounds}.${pence}`; -} - -//test----1 -let moneyA = "90p"; -console.log(`${pensToPounds(moneyA)}`); - -//test----2 -moneyA = "710p"; -console.log(`${pensToPounds(moneyA)}`); - -//test----3 -moneyA = "1210p"; -console.log(`${pensToPounds(moneyA)}`); From 8665943bf7d014e26a590ea539a87d2ea5fa41c4 Mon Sep 17 00:00:00 2001 From: PandiSimatupang Date: Wed, 16 Jul 2025 22:46:56 +0100 Subject: [PATCH 27/27] change const to let Sprint-1/2-mandatory-errors/1.js --- Sprint-1/2-mandatory-errors/1.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/1.js b/Sprint-1/2-mandatory-errors/1.js index 41e7f21a4..4c817b1dc 100644 --- a/Sprint-1/2-mandatory-errors/1.js +++ b/Sprint-1/2-mandatory-errors/1.js @@ -1,7 +1,9 @@ // trying to create an age variable and then reassign the value by 1 //create variable age -const age = 33; +let age = 33; //reassign variable age by 1 (+1) age = age + 1; + +console.assert(age); //Oh no.. that is mr. const