-
-
Notifications
You must be signed in to change notification settings - Fork 545
Cape Town | 26-ITP-Sept | Leigh Ross | Sprint 3 | Coursework: Sprint 3 #1580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
leigh-ross
wants to merge
48
commits into
CodeYourFuture:main
Choose a base branch
from
leigh-ross:coursework/sprint-3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
4fdac8d
Added hello_world and facts, Practiced console.log
leigh-ross e986963
Added file, decalred varible
leigh-ross da52a82
Added file, decalred varible
leigh-ross 21c1378
practicing variables
leigh-ross 24565bc
Practice comparing values
leigh-ross 6aa92d2
Practice if statement
leigh-ross b49b6c9
Password checker task
leigh-ross dc179bb
Practice identifying and explaining errors
leigh-ross f77cdce
Explained variable reassignment.
leigh-ross 1a46297
Getting the first char of a string
leigh-ross c67e10a
Explain code exercise
leigh-ross 8d45e6f
Slice exercise
leigh-ross 5125f87
Comment practice
leigh-ross d1b3b63
Var reassignment error handling
leigh-ross ec4411e
Assign var before print
leigh-ross aaecbb4
Splice works with strings not numbers
leigh-ross 6d0e108
Var name cannot start with a number
leigh-ross 8e8a147
Answered questions
leigh-ross dcb8312
Added error back in
leigh-ross 0dfc659
Answered questions
leigh-ross e574bb5
Answered questions
leigh-ross e339abe
Explained what each step in the code does
leigh-ross 7d2bbe6
Practice using chrome console
leigh-ross 656d965
Learning objects in JS
leigh-ross 82a1922
Merge branch 'coursework/sprint-2' of https://github.com/leigh-ross/M…
leigh-ross b492e02
remove prep files from coursework branch
leigh-ross 42e81a7
Replace all function fixed
leigh-ross bb1e2e0
Fixed dir and ext calculation
leigh-ross 4fef432
Changed movielength to og value
leigh-ross 5f75bcf
Predicted, explained and fixed the error
leigh-ross 194c793
Added original code and moved my code to end
leigh-ross ac1886b
Predicted, explained and fixed the code errors.
leigh-ross cd6e897
Predicted, explained and fixed code errors
leigh-ross 689ea33
Predicted, explained and fixed code errors
leigh-ross cf34a26
Predicted, explained and fixed code errors
leigh-ross 595728f
Predicted, explained and fixed code errors
leigh-ross 3c8783e
BMI calculator function
leigh-ross 0b6a121
Upper case and underscore conversion of strings
leigh-ross a680b43
Conversion function from sprint 2, to-pounds
leigh-ross 7277b60
Answered questions, rem calculations
leigh-ross 388daad
Added test cases, in process of fixing code
leigh-ross 47508e8
Reset Sprint-2 to match main
leigh-ross 09ae242
Made code more concise.
leigh-ross 8a05fa3
Applied proper naming conventions to function and variables.
leigh-ross e1c09ba
Finished and test code. All tests pass.
leigh-ross edf9927
Removed extra console.log()
leigh-ross f3aa942
Returned correct value in place of console.log()
leigh-ross c8d8431
Refactored code. Simplified to one return statement.
leigh-ross File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,31 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // capitalise function takes 1 str arg | ||
| // let srting will give an error if i try to pass my string. | ||
| // remove let | ||
| // str is being put in template literal | ||
| // str[0]: 1st index of str becomes uppercase | ||
| // str.slice(1): 2nd index slice until end of str | ||
| // str = "frankocean" | ||
| // return = "Frankocean" | ||
|
|
||
|
|
||
| // call the function capitalise with a string input | ||
| // interpret the error message and figure out why an error is occurring | ||
|
|
||
| function capitalise(str) { | ||
| let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str; | ||
| } | ||
| // function capitalise(str) { | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // return str; | ||
| // } | ||
|
|
||
|
|
||
| // =============> write your explanation here | ||
| // let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| // I was right, error given is because of let str within the function. | ||
| // SyntaxError: Identifier 'str' has already been declared | ||
| // We cannot have two declarations of the same variable so we remove the let inside .capitalise. | ||
| // =============> write your new code here | ||
| function capitalise(str) { | ||
| return `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| } | ||
| console.log(capitalise("frankocean")) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,26 @@ | ||
| // Predict and explain first... | ||
|
|
||
| // =============> write your prediction here | ||
| // It will print 2 lines: | ||
| // (10*32=320) line 1: 320 | ||
| // line 2: The result of multiplying 10 and 32 is undefined | ||
|
|
||
| function multiply(a, b) { | ||
| console.log(a * b); | ||
| } | ||
| // function multiply(a, b) { | ||
| // console.log(a * b); | ||
| // } | ||
|
|
||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
| // console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
| // There are two console.log() being called. | ||
| // The one inside the funtion prints the result of the multiplication | ||
| // The one outside the function prints the desired result of the whole string but there is no return from the function so it is undefined | ||
| // The result of multiplying 10 and 32 is undefined. | ||
|
|
||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function multiply(a, b) { | ||
| return a * b; | ||
| } | ||
|
|
||
| console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,24 @@ | ||
| // Predict and explain first... | ||
| // =============> write your prediction here | ||
| // I dont think the code will run at all since the return is separated from the sum that should happen | ||
| // the console.log() oustide the function will say the sum is undefined. | ||
|
|
||
| function sum(a, b) { | ||
| return; | ||
| a + b; | ||
| } | ||
| // function sum(a, b) { | ||
| // return; | ||
| // a + b; | ||
| // } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
| // console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); | ||
|
|
||
| // =============> write your explanation here | ||
| // The sum of 10 and 32 is undefined | ||
| // I was wrong, I thought that the code would not run. | ||
| // The output says the sum is undefined because the return statement and the "a + b" are separated by ; | ||
| // To fix it, I just need to remove the ; next to return on line 7. | ||
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function sum(a, b) { | ||
| return a + b; | ||
| } | ||
|
|
||
| console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.