From b285176131960a07deb98aca1e6e12cdafd7b1d8 Mon Sep 17 00:00:00 2001 From: bartoszkawiak Date: Tue, 15 Sep 2026 14:00:06 +0100 Subject: [PATCH 1/9] Create sprint-2 --- Sprint-2/coursework/sprint-2 | 1 + 1 file changed, 1 insertion(+) create mode 100644 Sprint-2/coursework/sprint-2 diff --git a/Sprint-2/coursework/sprint-2 b/Sprint-2/coursework/sprint-2 new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/Sprint-2/coursework/sprint-2 @@ -0,0 +1 @@ + From ef676e6d4c45329025505494584c8d8f501c25b1 Mon Sep 17 00:00:00 2001 From: bartoszkawiak Date: Tue, 15 Sep 2026 14:01:20 +0100 Subject: [PATCH 2/9] Delete Sprint-2/coursework directory --- Sprint-2/coursework/sprint-2 | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Sprint-2/coursework/sprint-2 diff --git a/Sprint-2/coursework/sprint-2 b/Sprint-2/coursework/sprint-2 deleted file mode 100644 index 8b1378917..000000000 --- a/Sprint-2/coursework/sprint-2 +++ /dev/null @@ -1 +0,0 @@ - From b7159b4f7d460f2457e7b7375856b9e567b535e2 Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Wed, 16 Sep 2026 14:57:48 +0100 Subject: [PATCH 3/9] count.js and initials.js exercises done --- Sprint-2/1-key-exercises/1-count.js | 3 +++ Sprint-2/1-key-exercises/2-initials.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 117bcb2b6..272b87803 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -2,5 +2,8 @@ let count = 0; count = count + 1; +// = is an assign operator so if count = 0 at line 1 then at line 3 count = 0 + 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 diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 964c9563c..74948ad2c 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,6 +5,11 @@ 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 = ``; +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 0d07b4824d8a81c034b4338fa1c3a6b235200c23 Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Wed, 16 Sep 2026 15:40:30 +0100 Subject: [PATCH 4/9] paths.js solved --- Sprint-2/1-key-exercises/3-paths.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index ab90ebb28..d391bce89 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,7 +17,10 @@ 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 = filePath.slice(-4) ; + +console.log(dir); +console.log(ext); // https://www.google.com/search?q=slice+mdn \ No newline at end of file From 50abd7384d431847f9624e6b9cb312771d154a05 Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Wed, 16 Sep 2026 15:50:55 +0100 Subject: [PATCH 5/9] key-exercises folder completed --- Sprint-2/1-key-exercises/4-random.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index 292f83aab..cc37ee4f5 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -2,6 +2,10 @@ const minimum = 1; const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; +//Math.floor is rounding down number from float number to integer +//Math.random create a random decimal number(float) from 0 up to 1 we then multiply it by (100) and add 1(minimum) +// variable num represents a random integer ranging from 1 to 100 +console.log(num); // 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 From 539375a89d719fc9508da1793c9733a1d6b68b2a Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Wed, 16 Sep 2026 16:47:32 +0100 Subject: [PATCH 6/9] 2-mandatory-errors completed --- Sprint-2/2-mandatory-errors/0.js | 5 ++++- Sprint-2/2-mandatory-errors/1.js | 2 ++ Sprint-2/2-mandatory-errors/2.js | 5 +++++ Sprint-2/2-mandatory-errors/3.js | 8 +++++++- Sprint-2/2-mandatory-errors/4.js | 2 ++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-errors/0.js b/Sprint-2/2-mandatory-errors/0.js index cf6c5039f..98b123dff 100644 --- a/Sprint-2/2-mandatory-errors/0.js +++ b/Sprint-2/2-mandatory-errors/0.js @@ -1,2 +1,5 @@ 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 +We don't want the computer to run these 2 lines - how can we solve this problem? + +//We have to use the // to comment a single line +/* or use /* to comment multiple lines */ \ 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..70a1269cd 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -2,3 +2,5 @@ const age = 33; age = age + 1; +/* const means that the variable cannot be reassigned we should use let keyword instead. +TypeError displayed due to that. */ \ No newline at end of file diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index e09b89831..060d54494 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -3,3 +3,8 @@ console.log(`I was born in ${cityOfBirth}`); const cityOfBirth = "Bolton"; + +//The error we see it's a ReferenceError which tells us that we cannot access variable before initialization. + +/*JavaScript reads the code from top to bottom, order is wrong. +Task cannot be executed as variable cannot be access before being created. */ \ 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..51e5157db 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 = cardNumber.toString().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,8 @@ 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 + + +/*The code would not work because cardNumber variable stores number data type and .slice() method cannot be used on a number, +if we run the code without changing data type to string we will get TypeError displayed +I used .toString() method to convert cardNumber variable to a string and then used .slice(-4) to get the last 4 digits. */ \ 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..acc443b1f 100644 --- a/Sprint-2/2-mandatory-errors/4.js +++ b/Sprint-2/2-mandatory-errors/4.js @@ -1,2 +1,4 @@ const 12HourClockTime = "8:53pm"; const 24hourClockTime = "20:53"; + +//A variable cannot start with a number, SyntaxError is displayed. \ No newline at end of file From 7304c3b48620a1cd3557c34b623bd9c998e79dc7 Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Wed, 16 Sep 2026 20:04:29 +0100 Subject: [PATCH 7/9] 3-mandatory-interpret completed --- .../3-mandatory-interpret/1-percentage-change.js | 9 ++++++++- Sprint-2/3-mandatory-interpret/2-time-format.js | 10 +++++++++- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 2 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..600274adf 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; @@ -20,3 +20,10 @@ console.log(`The percentage change is ${percentageChange}`); // 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? + +//a)There are 5 function calls on line 4, 5 and 10. +//b) error is coming from line 5, there is missing , between arguments in replaceAll method +//c) line 4 and 5 +//d) line 1,2 and 7,8 +/*e) replaceAll method inside of () replace comma with nothing, removing it from the string, +then Number converts string to number data type */ \ No newline at end of file diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index 47d239558..d6472b951 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -1,4 +1,4 @@ -const movieLength = 8784; // length of movie in seconds +const movieLength = -8784.08; // length of movie in seconds const remainingSeconds = movieLength % 60; const totalMinutes = (movieLength - remainingSeconds) / 60; @@ -23,3 +23,11 @@ console.log(result); // 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 + + +//a) There are 6 variable declarations. +//b)There is 1 function call on line 10 +//c) movieLength use remainder operator % . movieLength % 60 returns the remaining seconds after dividing the movie length into full minutes. +//d) expression assigned to totalMinutes calculate movie time in whole minutes. +//e) This variable represent total movie time in hh/mm/ss format, we could name it totalTime or totalMovieTime. +//f) Yes, the code works correctly when movieLength is non-negative whole number that represents seconds. \ No newline at end of file diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..a07105fb3 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -24,4 +24,18 @@ console.log(`£${pounds}.${pence}`); // Try and describe the purpose / rationale behind each step // To begin, we can start with + // 1. const penceString = "399p": initialises a string variable with the value "399p" +// 3. penceStringWithoutTrailingP is created using substring() on penceString. The purpose is to remove the trailing "p".. +// 4. value for substring method to start from which is beginning of the string. +// 5. penceString variable uses argument of .length to -1 (p) from the value, 399p becomes 399. +// 6. substring method closure +// 8. paddedPenceNumberString uses padStart() to make the string at least 3 characters long, adding "0" at the beginning when needed. +// 9. pounds variable assigns paddedPenceNumberString that uses substring method which returns part of the string from the start of index. +//10. value for substring method which is beginning of the string. +//11. paddedPenceNumberString variable is using length argument and deduct 2 out of length of the string 399 become 3 as pounds. +//12. Closes the substring method. +//14. pence variable created from paddedPenceNumberString +//15. substring method called which value of is in the parenthesis (variable length -2 characters) +//16. method padEnd is called that contains at least 2 character and adds 0 at the end if needed. +//18. we log £3.99 in the console. From a05fb5fba343e5beb4e2726e5d1a28203cee3d0d Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Thu, 17 Sep 2026 17:42:37 +0100 Subject: [PATCH 8/9] 4-stretch-explore completed --- Sprint-2/4-stretch-explore/chrome.md | 8 ++++++++ Sprint-2/4-stretch-explore/objects.md | 12 ++++++++++++ 2 files changed, 20 insertions(+) diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 962580b82..44b13d635 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -9,7 +9,15 @@ In the Chrome console, invoke the function `alert` with one argument, the string What effect does calling the `alert` function have? +### Alert would display a pop up window which can be used to display for example error messages. + 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`. + +### let myName = prompt("What is your name?"); + What effect does calling the `prompt` function have? What is the return value of `prompt`? + +### Prompt display text input option that we can store in a variable. +### prompt returns text that user entered in the input field \ No newline at end of file diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 0216dee56..4000db723 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -6,11 +6,23 @@ Open the Chrome devtools Console, type in `console.log` and then hit enter What output do you get? +### ƒ log() { [native code] } + + Now enter just `console` in the Console, what output do you get back? +### the output is console object with it's available properties and methods. + Try also entering `typeof console` +### console is an object + Answer the following questions: What does `console` store? + +### Console store functions that can interact with the console object + What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? + +### "." is used to access a property or method inside an object eg. console.log access the log function where .assert access the assert function \ No newline at end of file From e58f494238fd0b489c4fb5af76e3475689dc8210 Mon Sep 17 00:00:00 2001 From: Bartosz Kawiak Date: Fri, 18 Sep 2026 10:52:19 +0100 Subject: [PATCH 9/9] prettier used on sprint-2 --- Sprint-2/1-key-exercises/1-count.js | 1 - Sprint-2/1-key-exercises/2-initials.js | 5 ++--- Sprint-2/1-key-exercises/3-paths.js | 6 +++--- Sprint-2/1-key-exercises/4-random.js | 2 +- Sprint-2/2-mandatory-errors/1.js | 2 +- Sprint-2/2-mandatory-errors/2.js | 2 +- Sprint-2/2-mandatory-errors/3.js | 3 +-- Sprint-2/3-mandatory-interpret/1-percentage-change.js | 4 ++-- Sprint-2/3-mandatory-interpret/2-time-format.js | 3 +-- Sprint-2/3-mandatory-interpret/3-to-pounds.js | 8 ++++---- Sprint-2/4-stretch-explore/chrome.md | 4 ++-- Sprint-2/4-stretch-explore/objects.md | 3 +-- Sprint-2/README.md | 4 ++-- 13 files changed, 21 insertions(+), 26 deletions(-) diff --git a/Sprint-2/1-key-exercises/1-count.js b/Sprint-2/1-key-exercises/1-count.js index 272b87803..19c3f8bf4 100644 --- a/Sprint-2/1-key-exercises/1-count.js +++ b/Sprint-2/1-key-exercises/1-count.js @@ -4,6 +4,5 @@ count = count + 1; // = is an assign operator so if count = 0 at line 1 then at line 3 count = 0 + 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 diff --git a/Sprint-2/1-key-exercises/2-initials.js b/Sprint-2/1-key-exercises/2-initials.js index 74948ad2c..5055ac681 100644 --- a/Sprint-2/1-key-exercises/2-initials.js +++ b/Sprint-2/1-key-exercises/2-initials.js @@ -5,9 +5,8 @@ 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) +const initials = firstName.charAt(0); +middleName.charAt(0); lastName.charAt(0); console.log(initials); diff --git a/Sprint-2/1-key-exercises/3-paths.js b/Sprint-2/1-key-exercises/3-paths.js index d391bce89..9ecae1709 100644 --- a/Sprint-2/1-key-exercises/3-paths.js +++ b/Sprint-2/1-key-exercises/3-paths.js @@ -17,10 +17,10 @@ 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 =filePath.slice(0,lastSlashIndex) ; -const ext = filePath.slice(-4) ; +const dir = filePath.slice(0, lastSlashIndex); +const ext = filePath.slice(-4); console.log(dir); console.log(ext); -// https://www.google.com/search?q=slice+mdn \ No newline at end of file +// https://www.google.com/search?q=slice+mdn diff --git a/Sprint-2/1-key-exercises/4-random.js b/Sprint-2/1-key-exercises/4-random.js index cc37ee4f5..8da536bc2 100644 --- a/Sprint-2/1-key-exercises/4-random.js +++ b/Sprint-2/1-key-exercises/4-random.js @@ -3,7 +3,7 @@ const maximum = 100; const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; //Math.floor is rounding down number from float number to integer -//Math.random create a random decimal number(float) from 0 up to 1 we then multiply it by (100) and add 1(minimum) +//Math.random create a random decimal number(float) from 0 up to 1 we then multiply it by (100) and add 1(minimum) // variable num represents a random integer ranging from 1 to 100 console.log(num); diff --git a/Sprint-2/2-mandatory-errors/1.js b/Sprint-2/2-mandatory-errors/1.js index 70a1269cd..34bbfe5fd 100644 --- a/Sprint-2/2-mandatory-errors/1.js +++ b/Sprint-2/2-mandatory-errors/1.js @@ -3,4 +3,4 @@ const age = 33; age = age + 1; /* const means that the variable cannot be reassigned we should use let keyword instead. -TypeError displayed due to that. */ \ No newline at end of file +TypeError displayed due to that. */ diff --git a/Sprint-2/2-mandatory-errors/2.js b/Sprint-2/2-mandatory-errors/2.js index 060d54494..f3d08f744 100644 --- a/Sprint-2/2-mandatory-errors/2.js +++ b/Sprint-2/2-mandatory-errors/2.js @@ -7,4 +7,4 @@ const cityOfBirth = "Bolton"; //The error we see it's a ReferenceError which tells us that we cannot access variable before initialization. /*JavaScript reads the code from top to bottom, order is wrong. -Task cannot be executed as variable cannot be access before being created. */ \ No newline at end of file +Task cannot be executed as variable cannot be access before being created. */ diff --git a/Sprint-2/2-mandatory-errors/3.js b/Sprint-2/2-mandatory-errors/3.js index 51e5157db..f50e98f42 100644 --- a/Sprint-2/2-mandatory-errors/3.js +++ b/Sprint-2/2-mandatory-errors/3.js @@ -9,7 +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 - /*The code would not work because cardNumber variable stores number data type and .slice() method cannot be used on a number, if we run the code without changing data type to string we will get TypeError displayed -I used .toString() method to convert cardNumber variable to a string and then used .slice(-4) to get the last 4 digits. */ \ No newline at end of file +I used .toString() method to convert cardNumber variable to a string and then used .slice(-4) to get the last 4 digits. */ diff --git a/Sprint-2/3-mandatory-interpret/1-percentage-change.js b/Sprint-2/3-mandatory-interpret/1-percentage-change.js index 600274adf..52d456001 100644 --- a/Sprint-2/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-2/3-mandatory-interpret/1-percentage-change.js @@ -23,7 +23,7 @@ console.log(`The percentage change is ${percentageChange}`); //a)There are 5 function calls on line 4, 5 and 10. //b) error is coming from line 5, there is missing , between arguments in replaceAll method -//c) line 4 and 5 +//c) line 4 and 5 //d) line 1,2 and 7,8 /*e) replaceAll method inside of () replace comma with nothing, removing it from the string, -then Number converts string to number data type */ \ No newline at end of file +then Number converts string to number data type */ diff --git a/Sprint-2/3-mandatory-interpret/2-time-format.js b/Sprint-2/3-mandatory-interpret/2-time-format.js index d6472b951..c15cb1162 100644 --- a/Sprint-2/3-mandatory-interpret/2-time-format.js +++ b/Sprint-2/3-mandatory-interpret/2-time-format.js @@ -24,10 +24,9 @@ console.log(result); // f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer - //a) There are 6 variable declarations. //b)There is 1 function call on line 10 //c) movieLength use remainder operator % . movieLength % 60 returns the remaining seconds after dividing the movie length into full minutes. //d) expression assigned to totalMinutes calculate movie time in whole minutes. //e) This variable represent total movie time in hh/mm/ss format, we could name it totalTime or totalMovieTime. -//f) Yes, the code works correctly when movieLength is non-negative whole number that represents seconds. \ No newline at end of file +//f) Yes, the code works correctly when movieLength is non-negative whole number that represents seconds. diff --git a/Sprint-2/3-mandatory-interpret/3-to-pounds.js b/Sprint-2/3-mandatory-interpret/3-to-pounds.js index a07105fb3..adc11eee4 100644 --- a/Sprint-2/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-2/3-mandatory-interpret/3-to-pounds.js @@ -2,13 +2,13 @@ const penceString = "399p"; const penceStringWithoutTrailingP = penceString.substring( 0, - penceString.length - 1 + penceString.length - 1, ); const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); const pounds = paddedPenceNumberString.substring( 0, - paddedPenceNumberString.length - 2 + paddedPenceNumberString.length - 2, ); const pence = paddedPenceNumberString @@ -26,7 +26,7 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initialises a string variable with the value "399p" -// 3. penceStringWithoutTrailingP is created using substring() on penceString. The purpose is to remove the trailing "p".. +// 3. penceStringWithoutTrailingP is created using substring() on penceString. The purpose is to remove the trailing "p".. // 4. value for substring method to start from which is beginning of the string. // 5. penceString variable uses argument of .length to -1 (p) from the value, 399p becomes 399. // 6. substring method closure @@ -35,7 +35,7 @@ console.log(`£${pounds}.${pence}`); //10. value for substring method which is beginning of the string. //11. paddedPenceNumberString variable is using length argument and deduct 2 out of length of the string 399 become 3 as pounds. //12. Closes the substring method. -//14. pence variable created from paddedPenceNumberString +//14. pence variable created from paddedPenceNumberString //15. substring method called which value of is in the parenthesis (variable length -2 characters) //16. method padEnd is called that contains at least 2 character and adds 0 at the end if needed. //18. we log £3.99 in the console. diff --git a/Sprint-2/4-stretch-explore/chrome.md b/Sprint-2/4-stretch-explore/chrome.md index 44b13d635..5c8000d49 100644 --- a/Sprint-2/4-stretch-explore/chrome.md +++ b/Sprint-2/4-stretch-explore/chrome.md @@ -13,11 +13,11 @@ What effect does calling the `alert` function have? 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`. - ### let myName = prompt("What is your name?"); What effect does calling the `prompt` function have? What is the return value of `prompt`? ### Prompt display text input option that we can store in a variable. -### prompt returns text that user entered in the input field \ No newline at end of file + +### prompt returns text that user entered in the input field diff --git a/Sprint-2/4-stretch-explore/objects.md b/Sprint-2/4-stretch-explore/objects.md index 4000db723..d702ef9d6 100644 --- a/Sprint-2/4-stretch-explore/objects.md +++ b/Sprint-2/4-stretch-explore/objects.md @@ -8,7 +8,6 @@ What output do you get? ### ƒ log() { [native code] } - Now enter just `console` in the Console, what output do you get back? ### the output is console object with it's available properties and methods. @@ -25,4 +24,4 @@ What does `console` store? What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? -### "." is used to access a property or method inside an object eg. console.log access the log function where .assert access the assert function \ No newline at end of file +### "." is used to access a property or method inside an object eg. console.log access the log function where .assert access the assert function diff --git a/Sprint-2/README.md b/Sprint-2/README.md index a47afc540..d77309976 100644 --- a/Sprint-2/README.md +++ b/Sprint-2/README.md @@ -12,7 +12,7 @@ This README will guide you through the different sections for this week. ## 1 Exercises -In this section, you'll have a short program and task. Some of the syntax may be unfamiliar - in this case, you'll need to look things up in documentation. +In this section, you'll have a short program and task. Some of the syntax may be unfamiliar - in this case, you'll need to look things up in documentation. https://developer.mozilla.org/en-US/docs/Web/JavaScript @@ -28,7 +28,7 @@ You must use documentation to make sense of anything unfamiliar - learning how t You can also use `console.log` to check the value of different variables in the code. -https://developer.mozilla.org/en-US/docs/Web/JavaScript +https://developer.mozilla.org/en-US/docs/Web/JavaScript ## 4 Explore - Stretch 💪