Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8dc67a8
B done
AbdulqadirAbdillahi Dec 14, 2020
fe52111
C
AbdulqadirAbdillahi Dec 14, 2020
fbd526d
exercide d
AbdulqadirAbdillahi Dec 14, 2020
7b792b0
e exercise
AbdulqadirAbdillahi Dec 14, 2020
ea1271e
answers f to k
AbdulqadirAbdillahi Dec 15, 2020
1da95c7
Update exercise.js
AbdulqadirAbdillahi Dec 15, 2020
11dd1d9
Update 1-syntax-errors.js
AbdulqadirAbdillahi Dec 15, 2020
1ba5862
Update 2-logic-error.js
AbdulqadirAbdillahi Dec 15, 2020
e2962b6
Update 3-function-output.js
AbdulqadirAbdillahi Dec 15, 2020
78a1327
Update 4-tax.js
AbdulqadirAbdillahi Dec 15, 2020
ef5eef6
Update 1-syntax-errors.js
DouglasVDM Jan 16, 2021
d705ed0
Add comments after google search
DouglasVDM Jan 16, 2021
6abe75e
Add comments to changes
DouglasVDM Jan 16, 2021
c249f4d
C-variables
DouglasVDM Jan 17, 2021
d32cd9e
Exercise-D
DouglasVDM Jan 17, 2021
536905c
E-Strings-Concatenation
DouglasVDM Jan 17, 2021
88f9484
F-strings-methods
DouglasVDM Jan 17, 2021
566951e
F-strings-methods-exercise2
DouglasVDM Jan 17, 2021
40591b2
G-numbers
DouglasVDM Jan 17, 2021
3a15ad7
I-floats-exercise
DouglasVDM Jan 17, 2021
19b9c40
J-functions-exercise.js
DouglasVDM Jan 17, 2021
87245d1
J-functions-exercise2
DouglasVDM Jan 17, 2021
5d42014
K-functions-parameters-exercise1
DouglasVDM Jan 17, 2021
b9bfb6e
K-functions-parameters-exercise2
DouglasVDM Jan 17, 2021
75d4e88
K-functions-parameters-exercise3
DouglasVDM Jan 17, 2021
e6de8c0
K-functions-parameters-exercise4
DouglasVDM Jan 17, 2021
85c3407
K-functions-parameters-exercise5
DouglasVDM Jan 17, 2021
b895d6e
L-functions-nested-exercise1
DouglasVDM Jan 17, 2021
38b2718
L-functions-nested-exercise1-add %
DouglasVDM Jan 17, 2021
7340001
L-functions-nested-exercise1-add function for message
DouglasVDM Jan 18, 2021
cdb6a42
L-functions-nested-exercise2
DouglasVDM Jan 18, 2021
84755e7
mandatory-3-function-output
DouglasVDM Jan 18, 2021
d0a1842
Mandatory-4-tax-meet
DouglasVDM Jan 18, 2021
2b62668
L-functions-exercise-meet
DouglasVDM Jan 18, 2021
0573375
1-currency-conversion
DouglasVDM Jan 18, 2021
b04fffd
extra-2-piping
DouglasVDM Jan 18, 2021
e363d53
mandatory-4-tax-cleanup
DouglasVDM Jan 19, 2021
8e49331
extra-2-piping
DouglasVDM Jan 19, 2021
20b1ff6
Merge branch 'master' of https://github.com/DouglasVDM/JavaScript-Cor…
DouglasVDM Jan 20, 2021
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
13 changes: 12 additions & 1 deletion exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
console.log("Hello world");
console.log("Hello World");
console.log(5);

// When I console.log several things at once, I get a list of answers.

// When I get rid of quotes,I get a syntax error.
console.log(Hello World.I just started learning JavaScript!);

console.log("Hello World. I just started learning JavaScript!");

// A number without quotes.
console.log(205);
11 changes: 10 additions & 1 deletion exercises/C-variables/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Start by creating a variable `greeting`
var approach = "greeting";// Start by creating a variable `greeting`

let greeting = "Hello World"
console.log(greeting);

var approach = "greeting";// Start by creating a variable `greeting`

console.log(greeting);

var approach = "greeting";// Start by creating a variable `greeting`

console.log(greeting);
12 changes: 11 additions & 1 deletion exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Start by creating a variable `message`
const message = "This is a String";
const messageType = typeof message;


console.log(message);
console.log(messageType);

// My copy
const myText = "This is a String of Douglas";
const usingTypeof = typeof myText;

console.log(myText);
console.log(usingTypeof);
14 changes: 12 additions & 2 deletions exercises/E-strings-concatenation/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Start by creating a variable `message`
// const introduction = "Hello my name is";
// const name = " Abdulqadir";

console.log(message);
// console.log(introduction);
// console.log(name);

// My copy
let standardIntro = "Hello, my first name is";
let yourName = " Douglas.";

let greeting = standardIntro + yourName;

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

console.log(message);
// console.log(`My name is ${name} and my name is ${name.length} characters long`);


let myName = "Douglas Trainee";
let myNameLength = myName.length;

// With interpolation, I don't need to create another variable for the greeting text.
console.log(`My name is ${myName} and my name is ${myNameLength} characters long`);
18 changes: 16 additions & 2 deletions exercises/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
const name = " Daniel ";
let name = "Abdulqadir";
let addTrim = name.trim();
let newNameLength = addTrim.length;

console.log(message);
console.log(`my name is ${addTrim} and my name is ${newNameLength} characters long`);

let myName = " Douglas Trainee ";
let myNameLength = myName.length;

let myNameTrim = myName.trim();
let myNewNameLength = myNameTrim.length;

// 19 characters for myName
console.log(`My name is ${myName} and my name is ${myNameLength} characters long`);

// The whitespaces are removed: 15 characters for myName
console.log(`My name is ${myNameTrim} and my name is ${myNewNameLength} characters long`);
16 changes: 16 additions & 0 deletions exercises/G-numbers/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
// Start by creating a variables `numberOfStudents` and `numberOfMentors`
// let numberOfStudents = 15;
// let numberOfMentors = 3;
// let total = numberOfStudents + numberOfMentors;

// console.log(`number of students: ${numberOfStudents}`);
// console.log(`number of mentors: ${numberOfMentors}` );
// console.log(`total number of students and mentors: ${total}`);

// My copy.
let numberOfStudents = 30;
let numberOfMentors = 10;
let total = numberOfStudents + numberOfMentors;

console.log(`Number of students: ${numberOfStudents}`);
console.log(`Number of mentors: ${numberOfMentors}`);
console.log(`Total number of students and mentors: ${total}`);
25 changes: 23 additions & 2 deletions exercises/I-floats/exercise.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
var numberOfStudents = 15;
var numberOfMentors = 8;
// var numberOfStudents = 15;
// var numberOfMentors = 8;
// var total = numberOfStudents + numberOfMentors;

// var convertStudent = numberOfStudents/total*100;
// var convertMentors = numberOfMentors/total*100;

// var percentageOfStudents = Math.round(convertStudent);
// var percentageOfMentors = Math.round(convertMentors);

// console.log(`Student percentage: ${percentageOfStudents}%`);
// console.log(`Student percentage: ${percentageOfMentors}%`);

var numberOfStudents = 30;
var numberOfMentors = 10;
var total = numberOfStudents + numberOfMentors;

var convertStudents = numberOfStudents / total * 100;
var convertMentors = numberOfMentors / total * 100;

console.log(`Student percentage: ${convertStudents}%`);
console.log(`Mentor percentage: ${convertMentors}%`);

26 changes: 22 additions & 4 deletions exercises/J-functions/exercise.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
function halve(number) {
// complete the function here
// function halve(number) {
// return number/2;
// }

// var result = halve(12);
// var result1 = halve(20);
// var result2 = halve(30);
// var result3 = halve(100);

// console.log(result);
// console.log(result1);
// console.log(result2);
// console.log(result3);

function divide(number) {
return number / 2;
}

var result = halve(12);
var answer1 = divide(5);
var answer2 = divide(10);
var answer3 = divide(15);

console.log(result);
console.log(answer1);
console.log(answer2);
console.log(answer3);
17 changes: 13 additions & 4 deletions exercises/J-functions/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
function triple(number) {
// complete function here
// function triple(number) {
// return number*3
// }

// var result = triple(12);

// console.log(result);

// My copy.
function threeTimes(number) {
return (number * 3)*3;
}

var result = triple(12);
var answer = threeTimes(3);

console.log(result);
console.log(`The answer is ${answer}`)
2 changes: 1 addition & 1 deletion exercises/K-functions-parameters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function add(num1, num2) {

* Write a function that takes a name (a string) and returns a greeting

## Expected result
## Expected result

```
Hello, my name is Daniel
Expand Down
20 changes: 15 additions & 5 deletions exercises/K-functions-parameters/exercise.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
// Complete the function so that it takes input parameters
function multiply() {
// Calculate the result of the function and return it
// function multiply(num1, num2) {
// return num1*num2; // Calculate the result of the function and return it
// }

// // Assign the result of calling the function the variable `result`
// var result = multiply(3, 4);

// console.log(result);

// My copy.
function multiply(num1, num2) {
return num1 * num2;
}

// Assign the result of calling the function the variable `result`
var result = multiply(3, 4);
let answer = multiply(5, 10);

console.log(answer);

console.log(result);
17 changes: 14 additions & 3 deletions exercises/K-functions-parameters/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// Declare your function first
// function divide(num1, num2){
// return num1/num2;
// }// Declare your function first

var result = divide(3, 4);
// var result = divide(3, 4);

console.log(result);
// console.log(result);

// My copy.
function divide(num1, num2) {
return num1 / num2;
}

let answer = divide(5, 10);

console.log(Math.round(answer));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Douglas the expected results show 0.75 in the instructions and I see you using Math.round?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank you Jontaz77 for your comment. I'll review it and make the necessary changes.

16 changes: 13 additions & 3 deletions exercises/K-functions-parameters/exercise3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// Write your function here
// function createGreeting(name){
// return `Hello, my name is ${name}`;
// }// Write your function here

var greeting = createGreeting("Daniel");
// var greeting = createGreeting("Daniel");

console.log(greeting);
// console.log(greeting);

function standardGreeting(firstName) {
return `Hello my firstname is ${firstName}`
}

let greeting = standardGreeting("Douglas");

console.log(greeting);
18 changes: 15 additions & 3 deletions exercises/K-functions-parameters/exercise4.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// Declare your function first
// function add(num1, num2) {
// return num1+num2;
// }// Declare your function first

// Call the function and assign to a variable `sum`
// var sum = add(13,124);// Call the function and assign to a variable `sum`

console.log(sum);
// console.log(sum);

// My Copy.

function adding(num1, num2) {
return num1 + num2;
}

let sum = adding(5, 10);

console.log(sum);
17 changes: 14 additions & 3 deletions exercises/K-functions-parameters/exercise5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
// Declare your function here
// function createLongGreeting(name,age){
// return`Hello, my name is ${name} and I'm ${age} years old`
// }// Declare your function here

const greeting = createLongGreeting("Daniel", 30);
// const greeting = createLongGreeting("Daniel", 30);

console.log(greeting);
// console.log(greeting);

// My copy.
function nameAgeGreeting(yourName, yourAge) {
return `My name is ${yourName} and I'm ${yourAge} years old.`;
}

let greeting = nameAgeGreeting("Douglas", 47);

console.log(greeting);
Loading