Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Sprint-1/1-key-exercises/1-count.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,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 is a reassignment of the variable `count` to its current value plus 1
// Line 3 is a reassignment of the variable `count` to its current value plus 1.
// In other words, it increment by 1
6 changes: 3 additions & 3 deletions Sprint-1/1-key-exercises/4-random.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
// 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

// num represents a random number in an inclusive range from 1 to 100
// num represents a random number in the interval [1,100]
// First, it starts with 100 - 1 + 1, which is equals to 100
// Secondly, it multiply with Math.random(), which the function returns any number between 0 and 1, inclusive.
// Secondly, it multiply with Math.random(), which the function returns any number in the interval [0,1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you figure it is [0, 1] and not [0, 1)?

// Thirdly, Math.floor() rounds down and returns the largest integer less than or equal to a given number
// Finally, it adds 1
// Finally, it adds 1
6 changes: 3 additions & 3 deletions Sprint-1/3-mandatory-interpret/1-percentage-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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
// Line 4, 5
// Line 4, 5, 10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That still does not indicate how many function calls? And the answer is not 3.


// 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?
// It's missing a comma between the arguments at line 5 in replaceAll() method
Expand All @@ -24,5 +24,5 @@ console.log(`The percentage change is ${percentageChange}`);
// Line 1, 2

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
// Its purpose is to replace a substring with another string, in this case, replaces a command (",") with an empty string ("")
// In order words, remove the comma (",") in the string
// Its purpose is to replace a substring with another string and then convert it into a number, in this case, replaces a command (",") with an empty string ("")
// In other words, remove the comma (",") in the string and then convert it into a number
2 changes: 1 addition & 1 deletion Sprint-1/4-stretch-explore/chrome.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ It displays an alert with a textfield where you can enter some text, e.g. John.

What is the return value of `prompt`?

The string returned from the textfield what the user has entered otherwise null.
The string returned from the textfield what the user has entered otherwise null if the user left it blank.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the function return when the user does not enter anything and click the "OK" button? null or an empty string ""?

When does the function return null?