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
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}
5 changes: 4 additions & 1 deletion exercises/B-hello-world/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
console.log("Hello world");
console.log("Hello Sokrati");
console.log("Hello World. I just started learning JavaScript!");

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

let greeting = "Hello World!"
console.log(greeting);
console.log(greeting);
console.log(greeting);
3 changes: 3 additions & 0 deletions 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`
let message = "This is a string";
let messageType = typeof message;

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

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

console.log(greeting);
8 changes: 6 additions & 2 deletions exercises/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Start by creating a variable `message`
let greeting = "My name is"
let name = "sokratis";
let nameTwo = "and my name is"
let nameLength = name.length;
let char = "characters long"

console.log(message);
console.log(greeting + " " + name + " " + nameTwo + " " + nameLength + " " + char);
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 ";
let name = " Daniel ";
let trimName = name.trim;
let greeting = "My name is"
let nameTwo = "and my name is"
let nameLength = name.length;
let char = "characters long"

console.log(message);
console.log(greeting + " " + name + " " + nameTwo + " " + nameLength + " " + char);
15 changes: 14 additions & 1 deletion exercises/G-numbers/exercise.js
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
// Start by creating a variables `numberOfStudents` and `numberOfMentors`
let numberOfStudents = 15;
let studString ="Number of students:";
let numberOfMentors = 8;
let mentString = "Number of mentors:";

let total = numberOfStudents + numberOfMentors;
let totalString = "Total numnber of students and mentors:";

console.log (studString + " " + numberOfStudents);
console.log (mentString + " " + numberOfMentors);
console.log (totalString + " " + total);



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


let percentValue = 100 / (numberOfStudents + numberOfMentors);

let percentageStudents = Math.round(percentValue * numberOfStudents);
let PercentageMentors = Math.round(percentValue * numberOfMentors);

let result = `
Percentage students: ${percentageStudents}%
Percentage mentors: ${PercentageMentors}%
`;


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

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

var result = triple(12);
Expand Down
8 changes: 4 additions & 4 deletions exercises/K-functions-parameters/exercise.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// 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;
}

// Assign the result of calling the function the variable `result`

var result = multiply(3, 4);

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

var result = divide(3, 4);

Expand Down
9 changes: 7 additions & 2 deletions exercises/K-functions-parameters/exercise3.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Write your function here
let greeting = createGreeting("Daniel");

function createGreeting(name) {
return "Hello, my name is" + " " + name;

}


var greeting = createGreeting("Daniel");

console.log(greeting);
9 changes: 6 additions & 3 deletions 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 sum(num1 , num2) {
return num1 + num2;

}

console.log(sum(13,124));

// Call the function and assign to a variable `sum`

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

return "Hello my name is " + name + " I'm " + age + " years old"
}

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

Expand Down
23 changes: 18 additions & 5 deletions exercises/L-functions-nested/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
var mentor1 = "Daniel";
var mentor2 = "Irina";
var mentor3 = "Mimi";
var mentor4 = "Rob";
var mentor5 = "Yohannes";
let mentor1 = "Daniel";
let mentor2 = "Irina";
let mentor3 = "Mimi";
let mentor4 = "Rob";
let mentor5 = "Yohannes";


function shoutyGreetins(names) {
let upperNames = names.toUpperCase();
console.log("HELLO " + upperNames);
}


shoutyGreetins(mentor1);
shoutyGreetins(mentor2);
shoutyGreetins(mentor3);
shoutyGreetins(mentor4);
shoutyGreetins(mentor5);
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "javascript-core-1-coursework-week1",
"version": "1.0.0",
"description": "Exercises for JS1 Week 1",
"license": "CC-BY-SA-4.0",
"scripts": {
"test": "jest --testRegex='mandatory[/\\\\].*\\.js$'",
"extra-tests": "jest --testRegex='extra[/\\\\].*\\.js$'"
Expand All @@ -14,7 +15,9 @@
"url": "https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1/issues"
},
"jest": {
"setupFilesAfterEnv": ["jest-extended"]
"setupFilesAfterEnv": [
"jest-extended"
]
},
"homepage": "https://github.com/CodeYourFuture/JavaScript-Core-1-Coursework-Week1#readme",
"devDependencies": {
Expand Down