Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all 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
Empty file added .github/script.js
Empty file.
25 changes: 24 additions & 1 deletion exercises/B-hello-world/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,28 @@ Inside of `exercise.js` there's a line of code that will print "Hello world!".

- Try to `console.log()` something different. For example, 'Hello World. I just started learning JavaScript!'.
- Try to console.log() several things at once.
- What happens when you get rid of the quote marks?
- What happens when you get rid of the quote marks? it gives me this error
[Running] node "/Users/Coding/Documents/GitHub/HTML-CSS-Module-Project/HTML-CSS-Module-Project/JavaScript-Core-1-Coursework-Week1/exercises/B-hello-world/exercise.js"
/Users/Coding/Documents/GitHub/HTML-CSS-Module-Project/HTML-CSS-Module-Project/JavaScript-Core-1-Coursework-Week1/exercises/B-hello-world/exercise.js:1
console.log(Salve mondo);
^^^^^

SyntaxError: missing ) after argument list
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1033:15)
at Module._compile (node:internal/modules/cjs/loader:1069:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47

[Done] exited with code=1 in 0.304 seconds






- What happens when you console.log() just a number without quotes?
it gives me a result of 10, with a console.log (10)
2 changes: 1 addition & 1 deletion exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log("Hello world");
console.log(10);
3 changes: 3 additions & 0 deletions exercises/C-variables/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Start by creating a variable `greeting`
var greeting = "Hello world";

console.log(greeting);
console.log(greeting);
console.log(greeting);
5 changes: 4 additions & 1 deletion exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Start by creating a variable `message`

console.log(message);
var message = "Emeka";
var messageType = typeof message;

console.log(messageType);
7 changes: 5 additions & 2 deletions exercises/E-strings-concatenation/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Start by creating a variable `message`
var greetingStart = "Hello, my name is ";
var name = "Brolin";

console.log(message);
var greeting = greetingStart + name;

console.log(greeting);
5 changes: 3 additions & 2 deletions exercises/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Start by creating a variable `message`
var name = "Brolin";
var nameLength = name.length;

console.log(message);
console.log(nameLength);
3 changes: 2 additions & 1 deletion exercises/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const name = " Daniel ";
const name = " Brolin ";

console.log(message);

2 changes: 1 addition & 1 deletion exercises/G-numbers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Unlike strings, numbers do not need to be wrapped in quotes.
var age = 30;
```

You can use mathematical operators to caclulate numbers:
You can use mathematical operators to calculate numbers:

```js
var sum = 10 + 2; // 12
Expand Down
7 changes: 6 additions & 1 deletion exercises/G-numbers/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
// Start by creating a variables `numberOfStudents` and `numberOfMentors`
numberOfStudents = 15;
let numberOfMentors = 8;
let total = numberOfStudents + numberOfMentors
console.log(numberOfStudents)
console.log(numberOfMentors)
console.log(`total number of students and mentors: ${total}`)
5 changes: 5 additions & 0 deletions exercises/I-floats/exercise.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
var numberOfStudents = 15;
var numberOfMentors = 8;



var 7;
var roughAge = Math.round(preciseAge); // 30
12 changes: 6 additions & 6 deletions mandatory/1-syntax-errors.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// There are syntax errors in this code - can you fix it to pass the tests?

function addNumbers(a b c) {
function addNumbers(a,b,c) {
return a + b + c;
}

function introduceMe(name, age)
return "Hello, my name is " + name "and I am " age + "years old";

function introduceMe(name, age) {
return "Hello, my name is " + name + " and I am " + age + " years old";
}
function getTotal(a, b) {
total = a ++ b;
let total = a + b;

return "The total is total";
return "The total is "+ total;
}

/*
Expand Down
8 changes: 4 additions & 4 deletions mandatory/2-logic-error.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// The syntax for this function is valid but it has an error, find it and fix it.

function trimWord(word) {
return wordtrim();
return word.trim();
}

function getStringLength(word) {
return "word".length();
return word.length;
}

function multiply(a, b, c) {
a * b * c;
return;
return a * b * c;

}

/*
Expand Down
1 change: 1 addition & 0 deletions mandatory/3-function-output.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function combine2Words(word1, word2) {
}

function concatenate(firstWord, secondWord, thirdWord) {
return (firstWord + " " + secondWord + " " + thirdWord )
// Write the body of this function to concatenate three words together.
// Look at the test case below to understand what this function is expected to return.
}
Expand Down
10 changes: 8 additions & 2 deletions mandatory/4-tax.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
Sales tax is 20% of the price of the product.
*/

function calculateSalesTax() {}
function calculateSalesTax(price) {
return price * 1.2
}

/*
CURRENCY FORMATTING
Expand All @@ -17,7 +19,11 @@ function calculateSalesTax() {}
Remember that the prices must include the sales tax (hint: you already wrote a function for this!)
*/

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency(price) {
let total= calculateSalesTax(price)
total = total.toFixed(2)
return `£${total}`
}

/*
===================================================
Expand Down