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
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
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 @@
/** @format */

console.log("Hello world");
console.log("Hello World. I just started learning JavaScript!");
console.log("Hello NorthWest");
console.log("Hello Code your Future");
console.log("Hello class", 4, "Welcome to code your future");
console.log(4);
//console.log(codeyourfuture); this will generate error if we try to get rid of quotation marks--- javascript is considering this variable name which has not been defined.
7 changes: 6 additions & 1 deletion exercises/C-variables/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Start by creating a variable `greeting`
/** @format */

// Start by creating a variable `greeting`
let greeting = "Hello! there nice to meet you.";
//printing greeting three times
console.log(greeting);
console.log(greeting);
console.log(greeting);
6 changes: 5 additions & 1 deletion exercises/D-strings/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Start by creating a variable `message`
/** @format */

// Start by creating a variable `message`
var message = "Code Your Future brings the community together";
var messageType = typeof message;
console.log(message);
console.log(messageType);
8 changes: 7 additions & 1 deletion exercises/E-strings-concatenation/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/** @format */

// Start by creating a variable `message`
var greetingStart = "Hello, my name is ";
const name = "Anza";

var greeting = greetingStart + name;

console.log(message);
console.log(greeting); // Logs "Hello, my name is Anza"
8 changes: 7 additions & 1 deletion exercises/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/** @format */

// Start by creating a variable `message`
const myName = "Anza";
const nameLength = myName.length;

console.log(message);
console.log(
`My name is ${myName} and my name is ${nameLength} characters long`
);
9 changes: 7 additions & 2 deletions exercises/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const name = " Daniel ";
/** @format */

console.log(message);
const name = " Anza ";
const nameString = name.trim();
var nameLength = nameString.length;
console.log(
`My name is ${nameString} and my name is ${nameLength} 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 @@
/** @format */

// 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}`);

//prints total

console.log(
`Total number of Students and Mentors is: ${
numberOfStudents + numberOfMentors
}`
);
9 changes: 9 additions & 0 deletions exercises/I-floats/exercise.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
/** @format */

var numberOfStudents = 15;
var numberOfMentors = 8;
var total = numberOfMentors + numberOfStudents;
var percentageStudents = (numberOfStudents / total) * 100;
var percentageMentors = (numberOfMentors / total) * 100;

console.log(`Percentage of Students: ${Math.round(percentageStudents)}%`);

console.log(`Percentage of Mentors: ${Math.round(percentageMentors)}%`);
10 changes: 9 additions & 1 deletion exercises/J-functions/exercise.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/** @format */

function halve(number) {
// complete the function here
// complete the function here
var result = number / 2;
return result;
}

var result = halve(12);

console.log(result);

console.log(halve(36));

console.log(halve(100));
5 changes: 4 additions & 1 deletion exercises/J-functions/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/** @format */

function triple(number) {
// complete function here
// complete function here
return number * 3;
}

var result = triple(12);
Expand Down
9 changes: 7 additions & 2 deletions exercises/K-functions-parameters/exercise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** @format */

// Complete the function so that it takes input parameters
function multiply() {
// Calculate the result of the function and return it
function multiply(num1, num2) {
// Calculate the result of the function and return it

var result = num1 * num2;
return result;
}

// Assign the result of calling the function the variable `result`
Expand Down
7 changes: 7 additions & 0 deletions exercises/K-functions-parameters/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
/** @format */

// Declare your function first

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

var result = divide(3, 4);

console.log(result);
5 changes: 5 additions & 0 deletions exercises/K-functions-parameters/exercise3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @format */

// Write your function here
function createGreeting(name) {
return `Hello ${name}, its pleasure meeting you`;
}

var greeting = createGreeting("Daniel");

Expand Down
8 changes: 7 additions & 1 deletion exercises/K-functions-parameters/exercise4.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
// Declare your function first
/** @format */

// Declare your function first
function sum(num1, num2) {
var sum = num1 + num2;
return sum;
}
// Call the function and assign to a variable `sum`

var sum = sum(13, 124);
console.log(sum);
5 changes: 5 additions & 0 deletions exercises/K-functions-parameters/exercise5.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @format */

// Declare your function here
function createLongGreeting(name, age) {
return `Hello, my name is ${name} and I'm ${age} years old`;
}

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

Expand Down
18 changes: 18 additions & 0 deletions exercises/L-functions-nested/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
/** @format */

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

//function converts name to Uppercase
function createUpperCase(name) {
return name.toUpperCase();
}

//function generates a Shouty Message
function createGreeting(name) {
return `HELLO ${createUpperCase(name)}`;
}

console.log(createGreeting(mentor1));
console.log(createGreeting(mentor2));
console.log(createGreeting(mentor3));
console.log(createGreeting(mentor4));
console.log(createGreeting(mentor5));
Loading