This repository was archived by the owner on Jan 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 476
West Midlands 3 - Roman Halasi - JS Core 1 - Week 1 #205
Closed
Closed
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
a879e03
mandatory_1-syntax-error fixed
Roman-Hal df8cfe6
mandatory_2-logic-errors_fix
Roman-Hal 54b574a
madatory_3_function_output_fixed
Roman-Hal 7721fcd
mandatory_4_tax_fixed
Roman-Hal 4ea4c73
exercise_B_hello_world_test
Roman-Hal 0193ef7
exercise_C_variables_done
Roman-Hal 2334cc3
exercise_D_strings_done
Roman-Hal 3d97dd8
exercise_E_strings_concatenation_done
Roman-Hal b5cc114
exercise_F_strings_method_exercise1_done
Roman-Hal af4ded3
exercise_F_strings_methods_exercise2_done
Roman-Hal 96a770b
exercise_G_numbers_exercise_done
Roman-Hal 6610613
exercises_I_floats_exercise_done
Roman-Hal 8c5305b
exercises_J_functions_exercise1_done
Roman-Hal 782080c
exercises_J_functions_exercise2_done
Roman-Hal 5ebed6e
exercises_K_functions_exercise1_done
Roman-Hal 6ef4cf9
exercises_K_functions_exercise2_done
Roman-Hal 49f9b75
exercises_K_functions_exercise3_done
Roman-Hal 9d64433
exercises_K_functions_exercise4_done
Roman-Hal 37d87c4
exercises_K_functions_exercise5_done
Roman-Hal 396dc97
exercises_L_functions_exercise_done
Roman-Hal ef77485
extra_1_and_2
Roman-Hal 249150d
extra_3_magic_8_ball_done
Roman-Hal 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 +1,4 @@ | ||
| console.log("Hello world"); | ||
| console.log("Are you learning as well?"); | ||
| console.log("I " + "hope " + "that you know " + "what you are doing."); | ||
| console.log(3); |
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,3 +1,5 @@ | ||
| // Start by creating a variable `greeting` | ||
|
|
||
| var greeting = "Hello World"; | ||
| console.log(greeting); | ||
| console.log(greeting); | ||
| console.log(greeting); |
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,3 +1,5 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| var message = "This is a string"; | ||
| console.log(message); | ||
| var messageType = typeof message; | ||
| console.log(messageType); |
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,3 +1,5 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| var firstPart = "Hello, my name is "; | ||
| var secondPart = "Ro."; | ||
| var message = firstPart + secondPart; | ||
| console.log(message); |
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,3 +1,18 @@ | ||
| // Start by creating a variable `message` | ||
|
|
||
| var name = "Daniel"; | ||
| var nameLength = name.length; | ||
| var messagePart; | ||
| if (name.length === 1) { | ||
| var messagePart = "character"; | ||
| } else { | ||
| var messagePart = "characters"; | ||
| } | ||
| var message = | ||
| "My name is " + | ||
| name + | ||
| " and my name is " + | ||
| nameLength + | ||
| " " + | ||
| messagePart + | ||
| " long."; | ||
| console.log(message); |
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,3 +1,18 @@ | ||
| const name = " Daniel "; | ||
|
|
||
| var noSpaceName = name.trim(); | ||
| var nameLength = noSpaceName.length; | ||
| var messagePart; | ||
| if (noSpaceName.length === 1) { | ||
| var messagePart = "character"; | ||
| } else { | ||
| var messagePart = "characters"; | ||
| } | ||
| var message = | ||
| "My name is " + | ||
| noSpaceName + | ||
| " and my name is " + | ||
| nameLength + | ||
| " " + | ||
| messagePart + | ||
| " long."; | ||
| console.log(message); |
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 +1,9 @@ | ||
| // Start by creating a variables `numberOfStudents` and `numberOfMentors` | ||
| let numberOfStudents = 15; | ||
| let numberOfMentors = 8; | ||
| console.log("Number of students: " + numberOfStudents); | ||
| console.log("Number of mentors: " + numberOfMentors); | ||
| console.log( | ||
| "Total number of students and mentors: " + | ||
| (numberOfStudents + numberOfMentors) | ||
| ); |
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,2 +1,11 @@ | ||
| var numberOfStudents = 15; | ||
| var numberOfMentors = 8; | ||
| let total = numberOfStudents + numberOfMentors; | ||
| function percentageOf(num) { | ||
| var precisePercentage = (num / total) * 100; | ||
| let roughPercentage = Math.round(precisePercentage); | ||
| return roughPercentage; | ||
| } | ||
|
|
||
| console.log("Percentage students: " + percentageOf(numberOfStudents) + "%"); | ||
| console.log("Percentage mentors: " + percentageOf(numberOfMentors) + "%"); |
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,4 +1,5 @@ | ||
| function halve(number) { | ||
| return number / 2; | ||
| // complete the function here | ||
| } | ||
|
|
||
|
|
||
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,4 +1,5 @@ | ||
| function triple(number) { | ||
| return number * 3; | ||
| // complete function here | ||
| } | ||
|
|
||
|
|
||
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,5 +1,7 @@ | ||
| // Declare your function first | ||
|
|
||
| function divide(num1, num2) { | ||
| return num1 / num2; | ||
| } | ||
| var result = divide(3, 4); | ||
|
|
||
| console.log(result); |
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,5 +1,9 @@ | ||
| // Write your function here | ||
|
|
||
| function createGreeting(name) { | ||
| return "Hello, my name is " + name; | ||
| } | ||
|
|
||
| var greeting = createGreeting("Daniel"); | ||
|
|
||
| console.log(greeting); |
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,5 +1,9 @@ | ||
| // Declare your function first | ||
| function add(num1, num2) { | ||
| return num1 + num2; | ||
| } | ||
|
|
||
| // Call the function and assign to a variable `sum` | ||
| let sum = add(13, 124); | ||
|
|
||
| console.log(sum); |
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,5 +1,17 @@ | ||
| // Declare your function here | ||
|
|
||
| const greeting = createLongGreeting("Daniel", 30); | ||
| function createLongGreeting(name, age) { | ||
| let ageGreet; | ||
| if (age === 1) { | ||
| ageGreet = "year"; | ||
| } else { | ||
| ageGreet = "years"; | ||
| } | ||
| return ( | ||
| "Hello, my name is " + name + " and I'm " + age + " " + ageGreet + " old" | ||
| ); | ||
| } | ||
|
|
||
| const greeting = createLongGreeting("Daniel", 20); | ||
|
|
||
| console.log(greeting); |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done Roman, I like your code here, very clean, it was a slightly different approach than what I had done.