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 C-variables/main.js
Empty file.
Empty file added C-variables/ole.log(greeting);
Empty file.
8 changes: 8 additions & 0 deletions exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
console.log("Hello world");
console.log("Hello World. I just started learning JavaScript!");
console.log("hi there!")
console.log(44);

var greeting = "Hello world";
console.log(greeting);
console.log(greeting);
console.log(greeting);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of a variable.

4 changes: 3 additions & 1 deletion exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Start by creating a variable `message`
var letter ="from home office";
var letterType = typeof letter;
console.log(letterType);

console.log(message);
3 changes: 3 additions & 0 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 greetingWord = "Hi, my name is ";
var names = "Esam!";

var message = greetingWord + names;
console.log(message);
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`

console.log(message);
var names = " Esam ";
var nameLength = names.trim();
console.log(nameLength);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of .trim. You also need to use .length to get the number of letters in the name.

6 changes: 4 additions & 2 deletions exercises/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const name = " Daniel ";
const names = " Daniel ";
const message = names.trim();
// const nameLength = names.length;

console.log(message);
console.log(nameLength);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As with the previous exercise, you need to use .length to get the number of letters in the name

4 changes: 4 additions & 0 deletions exercises/G-numbers/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
// Start by creating a variables `numberOfStudents` and `numberOfMentors`
var numberOfStudents = 45;
var numberOfMentors = 10;
var TotalOfAll = numberOfMentors + numberOfStudents;
console.log(TotalOfAll);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your code is correctly adding 2 numbers and outputting the result. If you read the question and expected output, you will see that you should be using different numbers and outputting more details. Also, variable names in Javascript are normally in lower camel case, i.e. totalOfAll

6 changes: 6 additions & 0 deletions exercises/I-floats/exercise.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
var numberOfStudents = 15;
var numberOfMentors = 8;
var total = numberOfMentors + numberOfStudents;

var studentPercent = "Percentage Students:" + Math.round((numberOfStudents / total) * 100 ) + "%";
var mentorPercent = "Percentage Mentors:" + Math.round((numberOfMentors / total) * 100) + "%";
console.log(studentPercent);
console.log(mentorPercent);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of Math library

1 change: 1 addition & 0 deletions exercises/J-functions/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function halve(number) {
// complete the function here
return number / 2;
}

var result = halve(12);
Expand Down
1 change: 1 addition & 0 deletions exercises/J-functions/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function triple(number) {
// complete function here
return number * 3;
}

var result = triple(12);
Expand Down
3 changes: 2 additions & 1 deletion exercises/K-functions-parameters/exercise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Complete the function so that it takes input parameters
function multiply() {
function multiply(num1, num2) {
// Calculate the result of the function and return it
return num1 * num2;
}

// Assign the result of calling the function the variable `result`
Expand Down
5 changes: 3 additions & 2 deletions exercises/K-functions-parameters/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Declare your function first

function divide(num1, num2) {
return num1 / num2;
}
var result = divide(3, 4);

console.log(result);
4 changes: 3 additions & 1 deletion exercises/K-functions-parameters/exercise3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Write your function here

function createGreeting(name){
return "Hello, my name is " + name;
}
var greeting = createGreeting("Daniel");

console.log(greeting);
5 changes: 4 additions & 1 deletion exercises/K-functions-parameters/exercise4.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Declare your function first

function addition(num1,num2){
return num1 + num2;
}
// Call the function and assign to a variable `sum`
var sum = addition(13, 124);

console.log(sum);
4 changes: 3 additions & 1 deletion exercises/K-functions-parameters/exercise5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Declare your function here

function createLongGreeting (name, age){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good use of meaningful variable names

return "Hello, my name is " + name + " and I'm " + age +" years old";
}
const greeting = createLongGreeting("Daniel", 30);

console.log(greeting);
19 changes: 19 additions & 0 deletions exercises/L-functions-nested/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@

var mentor1 = "Daniel";
var mentor2 = "Irina";
var mentor3 = "Mimi";
var mentor4 = "Rob";
var mentor5 = "Yohannes";

function uppercaseName(name){
var updatedName = name.toUpperCase();
return updatedName;
}

function shouti(mentor){
var mentorName = uppercaseName(mentor);
var message = "Hello " + mentorName;
console.log(message);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You have clearly understood how to call one function from another, and again, you have used goo variable names.

shouti(mentor1);
shouti(mentor2);
shouti(mentor3);
shouti(mentor4);
shouti(mentor5);


12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,21 @@
"url": "https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1/issues"
},
"jest": {
"setupFilesAfterEnv": ["jest-extended"],
"setupFilesAfterEnv": [
"jest-extended"
],
"projects": [
{
"displayName": "mandatory",
"testMatch": ["<rootDir>/mandatory/*.js"]
"testMatch": [
"<rootDir>/mandatory/*.js"
]
},
{
"displayName": "extra",
"testMatch": ["<rootDir>/extra/*.js"]
"testMatch": [
"<rootDir>/extra/*.js"
]
}
]
},
Expand Down