From bd936fc8cb9e6bdcc74d8238384260da85a53621 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 22 Sep 2026 15:36:01 +0100 Subject: [PATCH 01/22] Key excercises for sprint 2 --- Sprint-2/1-key-exercises/1-count.js | 3 ++- Sprint-2/1-key-exercises/2-initials.js | 8 ++++---- Sprint-2/1-key-exercises/3-paths.js | 8 +++++--- Sprint-2/1-key-exercises/4-random.js | 7 +++++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..eeb9e9673 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -3,4 +3,5 @@ let count = 0; 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 +// Describe what line 3 is doing, in particular focus on what = reassign a variable using the = + operator. +//Line 1 assigns count = 0. Line 3 uses that value (0) and adds 1, so count becomes 1. \ No newline at end of file diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..e9fc80867 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -1,10 +1,10 @@ const firstName = "Creola"; const middleName = "Katherine"; const lastName = "Johnson"; - +const CKJ = "something" // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -const initials = ``; - -// https://www.google.com/search?q=get+first+character+of+string+mdn +const initials = `"${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}"`; +console.log(initials) +// // https://www.google.com/search?q=get+first+character+of+string+mdn diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..575259d63 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,9 @@ 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(0, lastSlashIndex); +const ext = base.slice(base.lastIndexOf(".")); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +// https://www.google.com/search?q=slice+mdn +console.log(`The dir part of ${filePath} is ${dir}`); +console.log(`The ext part of ${filePath} is ${ext}`); \ No newline at end of file diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..6e63bb1e5 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -7,3 +7,10 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // Try breaking down the expression and using documentation to explain what it means // 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 + +// In this exercise, num represent the value integer number between 1 to 100. +//Math.random generates a random decimal number from 0 up to 1, but not including, 1. +// down to the nearest whole number (integer). +//Running the program several times generate the whole number(integer) like (1,10,15,44,66,55) several times between 1 to 100 all 100 number has a equal 1% chance to appear(generate). +console . log (num) +// \ No newline at end of file From 7b9e573edc037f3432618400b815d8bd82cab6cd Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 22 Sep 2026 15:38:52 +0100 Subject: [PATCH 02/22] second commit for sprint change --- Sprint-2/2-mandatory-errors/0.js | 5 +++-- Sprint-2/2-mandatory-errors/1.js | 3 +++ Sprint-2/2-mandatory-errors/2.js | 3 +++ Sprint-2/2-mandatory-errors/3.js | 5 ++++- Sprint-2/2-mandatory-errors/4.js | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..d48de18d1 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,2 +1,3 @@ -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? +for single line we used // and for multiple line use /* \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 7a43cbea7..0aadb7463 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,3 +2,6 @@ const age = 33; age = age + 1; + +/* In this case age is not const means variable is not reassigned so that, + we throws a TypeError: Assignment to constant variable.2 diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..43d5d8516 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -3,3 +3,6 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; + + +/*we need to put declare variables(const cityOfBirth = "Bolton";) in first line after using expression console.log. \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index ec101884d..e64eb5c66 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,5 +1,6 @@ const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const last4Digits = string(cardNumber).slice(-4); +console.log (last4Digits); // The last4Digits variable should store the last 4 digits of cardNumber // However, the code isn't working @@ -7,3 +8,5 @@ const last4Digits = cardNumber.slice(-4); // Then run the code and see what error it gives. // Consider: Why does it give this error? Is this what I predicted? If not, what's different? // Then try updating the expression last4Digits is assigned to, in order to get the correct value +//Card number is a number not a string so it will throw typeerror. +// i did not think slice method can not run in number method so that i change it in string \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 5f86c730b..67705bc68 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,3 @@ const 12HourClockTime = "8:53pm"; const 24hourClockTime = "20:53"; +/*variable is not start with number show syntaxerror. From 878dae9dd897077c246a922f06cea29b80ec6a6b Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 22 Sep 2026 15:40:14 +0100 Subject: [PATCH 03/22] first formula related file in javascript --- .../1-percentage-change.js | 31 +++++++++++++------ .../3-mandatory-interpret/2-time-format.js | 13 ++++++-- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 7 ++++- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..458fa6d7f 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/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,24 @@ 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 - -// 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? - -// c) Identify all the lines that are variable reassignment statements - -// d) Identify all the lines that are variable declarations - -// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +/* there has five function in line 4 and and console . log also has one +line 4 and 5 has two Number() function +line 4 and 5 has two replaceALL() function +line 10 has one console . log () + +/* 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? + In line five error shown in replaceAll("," "")); missing comma before last two comma(",",""). + +/* c) Identify all the lines that are variable reassignment statements +line 4 carPrice = Number(carPrice.replaceAll(",", "")); +line 5 priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); +As per the carPrice and priceAfterOneYear has been declared in line 1 and 2 by using let variable. + +/*d) Identify all the lines that are variable declarations +line 1 let carPrice = "10,000"; +line 2 let priceAfterOneYear = "8,543"; +line 7 const priceDifference = carPrice - priceAfterOneYear; +line 8 const percentageChange = (priceDifference / carPrice) * 100; + +/* e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? +replaceALL throwout all the commas from the string and number became numerical value. diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..72f0689d4 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -1,5 +1,4 @@ -const movieLength = 8784; // length of movie in seconds - +const movieLength = 8784; const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -8,18 +7,28 @@ const totalHours = (totalMinutes - remainingMinutes) / 60; const result = `${totalHours}:${remainingMinutes}:${remainingSeconds}`; 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? +/* line 1 const movieLength line 3 const remainingSeconds line 4 const totalMinutes + line 6 const remainingMinutes line 7 const totalHours line 9 const result // b) How many function calls are there? +/* there are one function + console.log(result); // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators +/*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? +/* This expression convert movies time second into minutes dividend by 60 second. // e) What do you think the variable result represents? Can you think of a better name for this variable? +/* The variable represent the movieLength in second,minutes and hours. + We can change this name as movieTime. // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer +/* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50. diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..59d3eb0f1 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -4,18 +4,23 @@ const penceStringWithoutTrailingP = penceString.substring( 0, penceString.length - 1 ); - +// remove the p from the "399p" and make "399" const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +//padStart() add characters to the starting of the string and provide 3 long characters. +//Because we have to convert pound and pence. const pounds = paddedPenceNumberString.substring( 0, paddedPenceNumberString.length - 2 ); +// we take out the 2 character and store the remaining part of the string as the pound. const pence = paddedPenceNumberString .substring(paddedPenceNumberString.length - 2) .padEnd(2, "0"); + // At last we get the last two characters as the pence. console.log(`£${pounds}.${pence}`); +//We can display the price of pound and pence like £3.99. // This program takes a string representing a price in pence // The program then builds up a string representing the price in pounds From 982244fc3116d9ab5644d4394e4b1d8139aeed2f Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 22 Sep 2026 15:40:52 +0100 Subject: [PATCH 04/22] chrome and objects commit --- Sprint-2/4-stretch-explore/chrome.md | 4 ++++ Sprint-2/4-stretch-explore/objects.md | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 962580b82..27494e68a 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -8,8 +8,12 @@ Let's try an example. In the Chrome console, invoke the function `alert` with one argument, the string `"Hello world!"`; What effect does calling the `alert` function have? +Answer An alert popped up 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`. What effect does calling the `prompt` function have? +Answer A popup prompts me to write my name. + What is the return value of `prompt`? +Answer The value i entered in the text box. diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 0216dee56..ccad49517 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -5,12 +5,19 @@ In this activity, we'll explore some additional concepts that you'll encounter i Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? +Answer The output is ƒ log() { [native code] } Now enter just `console` in the Console, what output do you get back? +Answer console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, ...} but i can't copy it. + Try also entering `typeof console` +Answer It shows object' Answer the following questions: What does `console` store? +console is an object with properties that are function values. These functions are called methods because they belong to the console object. + What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? +console.log means "access the log method from the console object" and console.assert means "access the assert method from the console object. From a6a40aacfa5af64ee9cd3b5465dcac4446dbbd98 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Wed, 23 Sep 2026 21:01:36 +0100 Subject: [PATCH 05/22] changes --- Sprint-2/1-key-exercises/2-initials.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index e9fc80867..7bf527de4 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -1,7 +1,6 @@ const firstName = "Creola"; const middleName = "Katherine"; const lastName = "Johnson"; -const CKJ = "something" // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. From 3fbdf03aef3ac1ef7df3d957f0533a796c40b4b6 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Wed, 23 Sep 2026 21:53:37 +0100 Subject: [PATCH 06/22] line tag corrected --- Sprint-2/2-mandatory-errors/0.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index d48de18d1..c15168475 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,3 +1,3 @@ /*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? -for single line we used // and for multiple line use /* \ No newline at end of file +for single line we used // and for multiple line use */ \ No newline at end of file From 9aa6672989c97c7622d17e7d1a0bba9a9d2f06db Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Wed, 23 Sep 2026 22:19:34 +0100 Subject: [PATCH 07/22] deleted the "" from CKJ --- Sprint-2/1-key-exercises/2-initials.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 7bf527de4..5319d5d12 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -4,6 +4,6 @@ const lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -const initials = `"${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}"`; +const initials = `${firstName.charAt(0)}${middleName.charAt(0)}${lastName.charAt(0)}`; console.log(initials) // // https://www.google.com/search?q=get+first+character+of+string+mdn From 63fbd50a8449bdc459e081ae7c9adc9416e6737d Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Wed, 23 Sep 2026 22:47:44 +0100 Subject: [PATCH 08/22] Math.floor missing answer --- Sprint-2/1-key-exercises/4-random.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 6e63bb1e5..8ddf8390b 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -11,6 +11,8 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // In this exercise, num represent the value integer number between 1 to 100. //Math.random generates a random decimal number from 0 up to 1, but not including, 1. // down to the nearest whole number (integer). +// i think Changes the whole range to be greater by the minimum value +//Ensures the value never comes less than 1. //Running the program several times generate the whole number(integer) like (1,10,15,44,66,55) several times between 1 to 100 all 100 number has a equal 1% chance to appear(generate). console . log (num) // \ No newline at end of file From 453e08632b727a126dcf6f7d29b319f4e39c0903 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Wed, 23 Sep 2026 23:42:32 +0100 Subject: [PATCH 09/22] put let varible except const --- Sprint-2/2-mandatory-errors/1.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 0aadb7463..03b0600cf 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,7 +1,10 @@ // trying to create an age variable and then reassign the value by 1 -const age = 33; +const age =33; age = age + 1; /* In this case age is not const means variable is not reassigned so that, - we throws a TypeError: Assignment to constant variable.2 + /*we throws a TypeError: Assignment to constant variable*/ + //I try by let where console.log(age) shows Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\2-mandatory-errors\1.js" +//34. + From 7ab1778ff09c950815a79af649698d2bfd0e9f0b Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 00:05:03 +0100 Subject: [PATCH 10/22] edit --- Sprint-2/2-mandatory-errors/1.js | 5 ++--- Sprint-2/2-mandatory-errors/3.js | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 03b0600cf..e51fc3c15 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,10 +1,9 @@ // trying to create an age variable and then reassign the value by 1 -const age =33; +const age = 33; age = age + 1; /* In this case age is not const means variable is not reassigned so that, - /*we throws a TypeError: Assignment to constant variable*/ +/*we throws a TypeError: Assignment to constant variable*/ //I try by let where console.log(age) shows Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\2-mandatory-errors\1.js" //34. - diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index e64eb5c66..affb713d4 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -1,5 +1,5 @@ const cardNumber = 4533787178994213; -const last4Digits = string(cardNumber).slice(-4); +const last4Digits = String(cardNumber).slice(-4); console.log (last4Digits); // The last4Digits variable should store the last 4 digits of cardNumber @@ -9,4 +9,6 @@ console.log (last4Digits); // Consider: Why does it give this error? Is this what I predicted? If not, what's different? // Then try updating the expression last4Digits is assigned to, in order to get the correct value //Card number is a number not a string so it will throw typeerror. -// i did not think slice method can not run in number method so that i change it in string \ No newline at end of file +// i did not think slice method can not run in number method so that i change it in string +// when i put capital letter ReferenceError: string is not defined so that nothing last4Digits not showed +//in the terminal String is the function but string is the normal text. \ No newline at end of file From e211f67fd733e813949bf766985df17639ca56b9 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 01:04:47 +0100 Subject: [PATCH 11/22] console change let --- Sprint-2/2-mandatory-errors/1.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index e51fc3c15..875eee972 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -1,9 +1,11 @@ // trying to create an age variable and then reassign the value by 1 -const age = 33; +let age = 33; age = age + 1; +console.log(age); + /* In this case age is not const means variable is not reassigned so that, /*we throws a TypeError: Assignment to constant variable*/ - //I try by let where console.log(age) shows Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\2-mandatory-errors\1.js" + //I try by let where console.log(age) shows Running] node "c:\Users\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\2-mandatory-errors\1.js" //34. From 62fa64508d22558e047a9c62c475b4b15b8807c2 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 01:08:32 +0100 Subject: [PATCH 12/22] Reference error is not fixed --- Sprint-2/2-mandatory-errors/3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index affb713d4..1f99f6a23 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -6,9 +6,9 @@ console.log (last4Digits); // 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. -// Consider: Why does it give this error? Is this what I predicted? If not, what's different? +// Consider: Why does it give this error? Is this what I predicted? If not, what's different? // Then try updating the expression last4Digits is assigned to, in order to get the correct value //Card number is a number not a string so it will throw typeerror. // i did not think slice method can not run in number method so that i change it in string // when i put capital letter ReferenceError: string is not defined so that nothing last4Digits not showed -//in the terminal String is the function but string is the normal text. \ No newline at end of file +//in the terminal String is the function but string is the normal text. \ No newline at end of file From c32753d15a889eac7d1290aaa80d5eb5d82b32cd Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 01:22:17 +0100 Subject: [PATCH 13/22] placed the number at the end --- Sprint-2/2-mandatory-errors/4.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/4.js b/Sprint-2/2-mandatory-errors/4.js index 67705bc68..43a8f654c 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,3 +1,6 @@ -const 12HourClockTime = "8:53pm"; -const 24hourClockTime = "20:53"; -/*variable is not start with number show syntaxerror. +const HourClockTime12 = "8:53pm"; +const hourClockTime24 = "20:53"; + + +/*variable is not start with number show syntaxerror.*/ +// i just move the number at the end. \ No newline at end of file From 294f0f50021832571d57e2e1012e4ab7950a96a4 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 12:56:28 +0100 Subject: [PATCH 14/22] explain the percentage meaning --- Sprint-2/3-mandatory-interpret/2-time-format.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 72f0689d4..7499f12f1 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -13,22 +13,23 @@ console.log(result); // a) How many variable declarations are there in this program? /* line 1 const movieLength line 3 const remainingSeconds line 4 const totalMinutes - line 6 const remainingMinutes line 7 const totalHours line 9 const result + line 6 const remainingMinutes line 7 const totalHours line 9 const result*/ // b) How many function calls are there? /* there are one function - console.log(result); + console.log(result);*/ // c) Using documentation, explain what the expression movieLength % 60 represents // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators -/*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. +/*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? -/* This expression convert movies time second into minutes dividend by 60 second. +/* This expression convert movies time second into minutes dividend by 60 second*/ // e) What do you think the variable result represents? Can you think of a better name for this variable? /* The variable represent the movieLength in second,minutes and hours. - We can change this name as movieTime. + We can change this name as movieTime*/ // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer -/* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50. +/* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50 */ +/*"Percent (%) is a way to describe the full amount of anything by imagining it split into 100 equal sections.*/ \ No newline at end of file From cb44a345b280a818a8a8dbf0c1bed4b9260c7efa Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 13:03:41 +0100 Subject: [PATCH 15/22] explain that how to get exact time --- Sprint-2/3-mandatory-interpret/2-time-format.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 7499f12f1..52fcbdee4 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -32,4 +32,5 @@ console.log(result); // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer /* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50 */ -/*"Percent (%) is a way to describe the full amount of anything by imagining it split into 100 equal sections.*/ \ No newline at end of file +/*"Percent (%) is a way to describe the full amount of anything by imagining it split into 100 equal sections.*/ +/*we take out the odd seconds before converting to minutes so that when we divide by 60 we can get the exact whole number instead of messy decimal so that*/ \ No newline at end of file From 84b913cd06147531dc246a7adc20fb8f6a2a79db Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 24 Sep 2026 13:08:45 +0100 Subject: [PATCH 16/22] test the two different negative and decimal --- Sprint-2/3-mandatory-interpret/2-time-format.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 52fcbdee4..b5fa129b8 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -33,4 +33,14 @@ console.log(result); // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer /* In this section we can only use the positive natural numbers but if we put numbers that divide by 60 without a remainder get the exact time like 10, 20 50 */ /*"Percent (%) is a way to describe the full amount of anything by imagining it split into 100 equal sections.*/ -/*we take out the odd seconds before converting to minutes so that when we divide by 60 we can get the exact whole number instead of messy decimal so that*/ \ No newline at end of file +/*we take out the odd seconds before converting to minutes so that when we divide by 60 we can get the exact whole number instead of messy decimal so that*/ +/* i try both decimal both terminal is not showing the error type looks prefect */ +/*[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" +2:26:24 + +[Done] exited with code=0 in 1.932 seconds + +[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" +2:26:24 + +[Done] exited with code=0 in 0.165 seconds*/ \ No newline at end of file From 44b4c94f8b330654dad13acc35f9d5afbaac330a Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 01:34:09 +0100 Subject: [PATCH 17/22] change the symbol of text --- Sprint-2/2-mandatory-errors/2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 43d5d8516..390a2053a 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -5,4 +5,4 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; -/*we need to put declare variables(const cityOfBirth = "Bolton";) in first line after using expression console.log. \ No newline at end of file +/*we need to put declare variables(const cityOfBirth = "Bolton";) in first line after using expression console.log*/ \ No newline at end of file From 36baf7f94a610cfcc746d9bbc5f661f3795dcc75 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 01:47:17 +0100 Subject: [PATCH 18/22] Reverse the varible and console.log --- Sprint-2/2-mandatory-errors/2.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 390a2053a..a66d235bc 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -1,8 +1,7 @@ // 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}`); /*we need to put declare variables(const cityOfBirth = "Bolton";) in first line after using expression console.log*/ \ No newline at end of file From 1b10ec47ac82420d47d389b1e9dad2b1b2ba8d04 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 01:55:59 +0100 Subject: [PATCH 19/22] changes the formation of line tag --- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 458fa6d7f..d1e742e1a 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -15,21 +15,21 @@ console.log(`The percentage change is ${percentageChange}`); /* there has five function in line 4 and and console . log also has one line 4 and 5 has two Number() function line 4 and 5 has two replaceALL() function -line 10 has one console . log () +line 10 has one console . log ()*/ /* 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? - In line five error shown in replaceAll("," "")); missing comma before last two comma(",",""). + In line five error shown in replaceAll("," "")); missing comma before last two comma(",","").*/ /* c) Identify all the lines that are variable reassignment statements line 4 carPrice = Number(carPrice.replaceAll(",", "")); line 5 priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); -As per the carPrice and priceAfterOneYear has been declared in line 1 and 2 by using let variable. +As per the carPrice and priceAfterOneYear has been declared in line 1 and 2 by using let variable.*/ /*d) Identify all the lines that are variable declarations line 1 let carPrice = "10,000"; line 2 let priceAfterOneYear = "8,543"; line 7 const priceDifference = carPrice - priceAfterOneYear; -line 8 const percentageChange = (priceDifference / carPrice) * 100; +line 8 const percentageChange = (priceDifference / carPrice) * 100;*/ /* e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression? -replaceALL throwout all the commas from the string and number became numerical value. +replaceALL throwout all the commas from the string and number became numerical value.*/ From c1ded80e0c46caff5511962e5a7e80ab9d3fb6d5 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 02:01:44 +0100 Subject: [PATCH 20/22] complete the round down meaning --- Sprint-2/1-key-exercises/4-random.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 8ddf8390b..871dd0349 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -10,7 +10,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // In this exercise, num represent the value integer number between 1 to 100. //Math.random generates a random decimal number from 0 up to 1, but not including, 1. -// down to the nearest whole number (integer). +// Round down suppose 14.4 going to 14 as well as 14.9 also down to 14 to the nearest whole number (integer). // i think Changes the whole range to be greater by the minimum value //Ensures the value never comes less than 1. //Running the program several times generate the whole number(integer) like (1,10,15,44,66,55) several times between 1 to 100 all 100 number has a equal 1% chance to appear(generate). From cb34b66a2c95fe450a0939694907e53e6eeae9b8 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 02:26:55 +0100 Subject: [PATCH 21/22] change the answer --- Sprint-2/3-mandatory-interpret/2-time-format.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index b5fa129b8..18f4ab051 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -37,7 +37,7 @@ console.log(result); /* i try both decimal both terminal is not showing the error type looks prefect */ /*[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" 2:26:24 - +/* In this case 60% is the remaining second after take out all minutes there has remain second is 24 */ [Done] exited with code=0 in 1.932 seconds [Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" From e76423c76f4f6270e20223fb685f8473b584fc33 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Sun, 27 Sep 2026 02:28:52 +0100 Subject: [PATCH 22/22] last deleted --- Sprint-2/3-mandatory-interpret/2-time-format.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 18f4ab051..72e80772c 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -37,10 +37,4 @@ console.log(result); /* i try both decimal both terminal is not showing the error type looks prefect */ /*[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" 2:26:24 -/* In this case 60% is the remaining second after take out all minutes there has remain second is 24 */ -[Done] exited with code=0 in 1.932 seconds - -[Running] node "c:\Users\Asus\Desktop\code your future\Module-Onboarding\Module-JavaScript-Fundamentals\Sprint-2\Sprint-2\3-mandatory-interpret\2-time-format.js" -2:26:24 - -[Done] exited with code=0 in 0.165 seconds*/ \ No newline at end of file +/* In this case 60% is the remaining second after take out all minutes there has remain second is 24 */ \ No newline at end of file