From 65fe894c55650890c8d4d67df0e17368a5f9426b Mon Sep 17 00:00:00 2001 From: Ahmad Date: Mon, 16 Jun 2025 17:22:09 +0100 Subject: [PATCH 01/17] Answered comment for count update in exercise -1 --- Sprint-1/1-key-exercises/1-count.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6..49b7b3bdc 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,5 @@ 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 +// line 3 increases the value of count by 1. +// the "=" operator assigns the result of "count + 1" back to the variable count. \ No newline at end of file From c7a00b770cebfba9f85c895fe70be9d7432bd9b7 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Mon, 16 Jun 2025 18:12:06 +0100 Subject: [PATCH 02/17] completed initials exercise using string indexing --- Sprint-1/1-key-exercises/2-initials.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f617..1e2a39ae4 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,7 +5,12 @@ let 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. -let initials = ``; +let initials = firstName[0] + middleName[0] + lastName[0]; +console.log(initials) +// fistName[0] gets the first character of the string "Creola" C +// middleName[0] gets the second character of the name "Katherine" K +// lastName[0] gets the third character of the name "Johnson" J + // https://www.google.com/search?q=get+first+character+of+string+mdn From 189161454157492d65fb0b69e9b425ab1b5042bd Mon Sep 17 00:00:00 2001 From: Ahmad Date: Mon, 16 Jun 2025 23:36:43 +0100 Subject: [PATCH 03/17] Add dir and ext veriables to extract directory and extension from file path. --- Sprint-1/1-key-exercises/3-paths.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-1/1-key-exercises/3-paths.js b/Sprint-1/1-key-exercises/3-paths.js index ab90ebb28..bebd818db 100644 --- a/Sprint-1/1-key-exercises/3-paths.js +++ b/Sprint-1/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(".")); +// dir uses slice(lastSlashIndex) to get everything before the last slash +// ext used base.slice(base.lastIndexOf(".")) to get .txt // https://www.google.com/search?q=slice+mdn \ No newline at end of file From a9f60fe5bb73c7b6d639dfd4a3eb690e60d5ec37 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 02:14:03 +0100 Subject: [PATCH 04/17] Add explanation of how num is calculated as a random number between munimum and maximum. --- Sprint-1/1-key-exercises/4-random.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-1/1-key-exercises/4-random.js b/Sprint-1/1-key-exercises/4-random.js index 292f83aab..6d92e7e06 100644 --- a/Sprint-1/1-key-exercises/4-random.js +++ b/Sprint-1/1-key-exercises/4-random.js @@ -7,3 +7,11 @@ 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 + +// The variable "num" stores a random whole number between 1 and 100. +// The expression works as follows: +// 1: Math.random() generates a decimal 0 to 1 (not including 1) +// This decimal is multiplied by (maximum - minimum + 1) which gives a number between 0 and 99.999. +// Math.floor() then rounds this down to a whole number between 0 to 99. +// Adding "minimum" shifts the result so the final number is between 1 to 100. +// for this reason num changes every time when you run the program always gives the number between 1 to 100. From ac2cdb55affd79b347fbb77f590876fd7370f46c Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 03:15:29 +0100 Subject: [PATCH 05/17] fixed error by changing const to let for age reasignment. --- Sprint-1/2-mandatory-errors/1.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sprint-1/2-mandatory-errors/1.js b/Sprint-1/2-mandatory-errors/1.js index 7a43cbea7..8b10c8e50 100644 --- a/Sprint-1/2-mandatory-errors/1.js +++ b/Sprint-1/2-mandatory-errors/1.js @@ -2,3 +2,7 @@ const age = 33; age = age + 1; + +// Error: The variable const for the "age" value can not be reassigned +// const means "constant" once assigned, it can not be changed. +// to fix this error, we use "let" instead of "const" to declare the age variable. \ No newline at end of file From 3966773d10f89e8924ddb850f077899eda4fb0a7 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 14:50:44 +0100 Subject: [PATCH 06/17] Fixed reference error by declaring cityOfBirth before using it. --- Sprint-1/2-mandatory-errors/2.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index e09b89831..1e4200e58 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,5 +1,10 @@ // 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"; + +// Reference error:can not access "cityOfBirth" before initialization +// in this code the variable "cityOfBirth" is used before it is been declared" +// solution: Move the const line above the console.log \ No newline at end of file From 9328618be54dd37af6f5c6cfb034c66f69e598b4 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 15:38:50 +0100 Subject: [PATCH 07/17] fixed typeEroor by converting number to string before slicing last 4 digits. --- Sprint-1/2-mandatory-errors/3.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/3.js b/Sprint-1/2-mandatory-errors/3.js index ec101884d..3b9fe839e 100644 --- a/Sprint-1/2-mandatory-errors/3.js +++ b/Sprint-1/2-mandatory-errors/3.js @@ -1,5 +1,6 @@ -const cardNumber = 4533787178994213; -const last4Digits = cardNumber.slice(-4); +const cardNumber = "4533787178994213"; +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,7 @@ 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 +// TypeError: cardNumber.slice is not a function. it was not the error i predicted, and the difference is that i predicted that the code is correct just add console.log variable. +// How to fix this error: first convert number "toString", then use .slice(-4);. +// The "toString()" method converts number to string. +// java script has trouble with large number so in this case we add the number in string(""). From 420793680303cd52fa21d87428044384869a9ace Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 16:37:11 +0100 Subject: [PATCH 08/17] Fixed syntax error by moving numbers after the words or spell the numbers out, and fixed the format of the clock which was written incorrectly. --- Sprint-1/2-mandatory-errors/4.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-1/2-mandatory-errors/4.js b/Sprint-1/2-mandatory-errors/4.js index 21dad8c5d..252de2704 100644 --- a/Sprint-1/2-mandatory-errors/4.js +++ b/Sprint-1/2-mandatory-errors/4.js @@ -1,2 +1,8 @@ const 12HourClockTime = "20:53"; -const 24hourClockTime = "08:53"; \ No newline at end of file +const 24hourClockTime = "08:53"; + +// syntax error: java script does not allow variable names to start with a number as in above examples: "12HourClockTime", "24hoursClockTime". +// The value does not match in both 24hour and 12hour formats. +// Solution: move the numbers after the words or spell the numbers out. +// the variables should be named like this: const hourClockTime12 = "08:53";, const hourClockTime24 = "20:53";. +// Or like spell the number out: const twelveHourClockTime = "08:53"; , const twentyFourHourClockTime = "20:53";. From bf8a890520e5abea7b10f2aa47790bc556dd8c5f Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 17:50:22 +0100 Subject: [PATCH 09/17] Fixed syntax error in replaceAll for priceafteroneyear, and answer interpret exercise questions about function calls and variables. --- Sprint-1/3-mandatory-interpret/1-percentage-change.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-1/3-mandatory-interpret/1-percentage-change.js b/Sprint-1/3-mandatory-interpret/1-percentage-change.js index e24ecb8e1..d671c96fe 100644 --- a/Sprint-1/3-mandatory-interpret/1-percentage-change.js +++ b/Sprint-1/3-mandatory-interpret/1-percentage-change.js @@ -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? + +// Answer a: 1: carPrice.replaceAll(",", "")- line-4, 2:Number(...)- line-4, 3: priceAfterOneYear.replaceAll(",","")__line-5, 4: Number(...)__line-5, 5: console.log(...)__line-10. +// Answer b: the line 5 has an error, the second replaceAll is missing a comma between the two arguments. to fix this problem add a comma between the two arguments. +// Answer c: line 4 and 5 are variable reassignments. +// Answer d: line 1,2,7 and 8 are variable declarations. +// Answer e: 1: carPrice.replaceAll(",", "")) replaces all commas in "10,000" in an empty string "10000". 2: Number("10000") converts the string "10000" into a number 10000. +// and the purpose of this expression is to clean the price string by removing commas and convert it into a number. \ No newline at end of file From 34c796a3c56563496f13b1ab512c4c9f5ba2d77e Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 19:59:50 +0100 Subject: [PATCH 10/17] Added Answers to the questions about time conversion exercise. Added explanation for variable declaration, function calls, and expressions used in time conversion code. --- Sprint-1/3-mandatory-interpret/1-percentage-change.js | 2 +- Sprint-1/3-mandatory-interpret/2-time-format.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Sprint-1/3-mandatory-interpret/1-percentage-change.js b/Sprint-1/3-mandatory-interpret/1-percentage-change.js index d671c96fe..e8a090497 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; diff --git a/Sprint-1/3-mandatory-interpret/2-time-format.js b/Sprint-1/3-mandatory-interpret/2-time-format.js index 47d239558..29d520509 100644 --- a/Sprint-1/3-mandatory-interpret/2-time-format.js +++ b/Sprint-1/3-mandatory-interpret/2-time-format.js @@ -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 + +// Answer a: There are 6 variable declarations in this program: movieLength, remainingSeconds,totalMinutes,totalHours,remainingMinutes, and result. +// Answer b: There is only one function call "console,log(result);". +// Answer c: The expression movieLength % 60 uses the modules operator (%) which returns the remainder after dividing movieLength by 60. +// This tells us how many remainder seconds are left after converting the total time into full minutes. +// Answer d: This line calculates the total number of complete minutes in the movie after removing the leftover seconds. in first subtract the remaining seconds then divide the rest by 60 to convert seconds by minutes. +// Answer e: result stores the formatted time in hours,minutes,seconds. A better name for this variable formattedTime,durationString,timeInHMS. +// Answer f: yes, it works for all non negative integer values of movieLength From b83f1526ae3330a4ca2fbf2ca41a10b0648fec23 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 23:14:47 +0100 Subject: [PATCH 11/17] Added breakdown of code converting pence string to pound format. --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 60c9ace69..2dcd17abf 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -24,4 +24,13 @@ 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" +// 1. const penceString = "399p": initializes a string variable with the value "399p" + + +// 2: "const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1)"__ Removes the trailing "p" character. +// substring(0,penceString.length - 1) this code gets all characters except the last one. so "399p" becomes just"399". +// 3: const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") Ensures the pence string that has at least 3 digits, by padding it in left with "0" if needed for example: 399 stays 399 or 7 would become 007. +// 4: const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2) Extracts the pound portion (except the last two one) __ "399"-"3"(pounds) +// 5: const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0") Gets the last two digits as the pence part. for example: "399"__"99"(pence) +// padEnd(2, "0") ensures at least two digits for pence.__eg: "3"_"30". +// 6: console.log(`£${pounds}.${pence}`) logs the full formatted price in pounds and pence.__eg:for "399P" pounds"3" pence"99" and the result is __ "3.99" From 254cd3f491e4efff01044d696cf3c89960db8be9 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Tue, 17 Jun 2025 23:43:44 +0100 Subject: [PATCH 12/17] completed chrome console exercise using prompt and alert --- Sprint-1/4-stretch-explore/chrome.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index e7dd5feaf..df52ba25a 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -11,8 +11,11 @@ In the Chrome console, invoke the function `alert` with an input string of `"Hello world!"`; What effect does calling the `alert` function have? +A popup appears with the message ("Hello world!") 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? +It opens a popup asking for the user’s name, and lets the user type something. What is the return value of `prompt`? +A string that contains what the user typed (e.g. “Ahmad”). From 7a97c4fc3439b876d9ac01900579cee355357ac4 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Wed, 18 Jun 2025 02:03:52 +0100 Subject: [PATCH 13/17] investigate console object and dot notation in java script using chrome Devetools. --- Sprint-1/4-stretch-explore/objects.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-1/4-stretch-explore/objects.md b/Sprint-1/4-stretch-explore/objects.md index 0216dee56..5e28f58d8 100644 --- a/Sprint-1/4-stretch-explore/objects.md +++ b/Sprint-1/4-stretch-explore/objects.md @@ -5,12 +5,17 @@ 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? +ƒ log() { [native code] } this output i got when i entered the 'console.log' this function is named 'log'. Now enter just `console` in the Console, what output do you get back? +console {debug: ƒ, error: ƒ, info: ƒ, log: ƒ, warn: ƒ, …} it contains many functions, we can use it for logging and debugging. Try also entering `typeof console` Answer the following questions: What does `console` store? +The "console" stores the collection of functions used for logging and debugging your java code. What does the syntax `console.log` or `console.assert` mean? In particular, what does the `.` mean? +these are using dot notation, console is an object and log and assert are methods(functions). +dot means access a property or method that belongs to an object. From 567e88fad93b114ed73522a351a97de7f9979f62 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Sat, 12 Jul 2025 17:07:14 +0100 Subject: [PATCH 14/17] Answered the question of line-9. --- Sprint-1/1-key-exercises/1-count.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 49b7b3bdc..f93ffbcfc 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -5,4 +5,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 // line 3 increases the value of count by 1. -// the "=" operator assigns the result of "count + 1" back to the variable count. \ No newline at end of file +// the "=" operator assigns the result of "count + 1" back to the variable count. +// Can you find out what one-word programming term describes the operation on line 3? +// The one word term is "increment". +// increment means increasing the value of a variable by 1. From 2f51f5babd9a4e62e440216f26d4a987523fb042 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Sat, 12 Jul 2025 17:23:41 +0100 Subject: [PATCH 15/17] Replaced the word Const line to Const Variable on 9. --- Sprint-1/2-mandatory-errors/2.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sprint-1/2-mandatory-errors/2.js b/Sprint-1/2-mandatory-errors/2.js index 1e4200e58..b4a8768d1 100644 --- a/Sprint-1/2-mandatory-errors/2.js +++ b/Sprint-1/2-mandatory-errors/2.js @@ -1,10 +1,9 @@ // 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"; // Reference error:can not access "cityOfBirth" before initialization -// in this code the variable "cityOfBirth" is used before it is been declared" -// solution: Move the const line above the console.log \ No newline at end of file +// in this code the variable "cityOfBirth" is used before it is been declared" +// solution: Move the const variable above the console.log From 838110d1696a350eae1b32f24379f1395c60a766 Mon Sep 17 00:00:00 2001 From: Ahmad Date: Sat, 12 Jul 2025 17:38:53 +0100 Subject: [PATCH 16/17] Answered the question on line 36 & 37. --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 2dcd17abf..43e7315e4 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -26,11 +26,13 @@ console.log(`£${pounds}.${pence}`); // To begin, we can start with // 1. const penceString = "399p": initializes a string variable with the value "399p" - // 2: "const penceStringWithoutTrailingP = penceString.substring(0,penceString.length - 1)"__ Removes the trailing "p" character. -// substring(0,penceString.length - 1) this code gets all characters except the last one. so "399p" becomes just"399". -// 3: const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") Ensures the pence string that has at least 3 digits, by padding it in left with "0" if needed for example: 399 stays 399 or 7 would become 007. -// 4: const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2) Extracts the pound portion (except the last two one) __ "399"-"3"(pounds) +// substring(0,penceString.length - 1) this code gets all characters except the last one. so "399p" becomes just"399". +// 3: const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0") Ensures the pence string that has at least 3 digits, by padding it in left with "0" if needed for example: 399 stays 399 or 7 would become 007. +// 4: const pounds = paddedPenceNumberString.substring(0,paddedPenceNumberString.length - 2) Extracts the pound portion (except the last two one) __ "399"-"3"(pounds) // 5: const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0") Gets the last two digits as the pence part. for example: "399"__"99"(pence) // padEnd(2, "0") ensures at least two digits for pence.__eg: "3"_"30". // 6: console.log(`£${pounds}.${pence}`) logs the full formatted price in pounds and pence.__eg:for "399P" pounds"3" pence"99" and the result is __ "3.99" +// Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code? +// In other words, do we really need .padEnd(2, "0") in this script? +// Yes, we need `.padEnd(2, "0")` to ensure the penceString is always at least two digits long. From 832af0e115d5f31a5d701e9658fc5cea321f2b7d Mon Sep 17 00:00:00 2001 From: Ahmad Date: Sat, 12 Jul 2025 18:26:19 +0100 Subject: [PATCH 17/17] Answered the questio on line 23 & 24. --- Sprint-1/4-stretch-explore/chrome.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-1/4-stretch-explore/chrome.md b/Sprint-1/4-stretch-explore/chrome.md index df52ba25a..a6af848f3 100644 --- a/Sprint-1/4-stretch-explore/chrome.md +++ b/Sprint-1/4-stretch-explore/chrome.md @@ -19,3 +19,10 @@ What effect does calling the `prompt` function have? It opens a popup asking for the user’s name, and lets the user type something. What is the return value of `prompt`? A string that contains what the user typed (e.g. “Ahmad”). + +If we were writing a program that uses prompt() to ask for an input value, how could +the program check if the user clicked "OK" or "Cancel"? + +If the user clicks **OK**, it returns the string they typed, even an empty string when there is nothing written. + +If the user clicks **Cancel**, it returns null.