Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0de4b8c
Added first exercise files
Nov 1, 2025
a5ac329
Added aboutme exercise files
Nov 1, 2025
03a53bf
Added form exercise files
Nov 1, 2025
76388a3
Added table exercise files
Nov 1, 2025
bbb7c70
Merge pull request #1 from MonikaShaik/html-and-css
MonikaShaik Nov 1, 2025
a139166
Revert "Html and css"
MonikaShaik Nov 1, 2025
c71ed9b
Merge pull request #2 from MonikaShaik/revert-1-html-and-css
MonikaShaik Nov 1, 2025
7269eb9
Added text about dumplings
Nov 1, 2025
14dcd5e
Added second favourite food name
Nov 1, 2025
fefd634
Added list of countries
Nov 1, 2025
505a275
revert the previous commits
Nov 1, 2025
18228ac
Added JavaScrip files
Nov 13, 2025
9801440
Added next JavaScript exercises.
Nov 24, 2025
636ac2c
Added exercises from week 3
Nov 27, 2025
1235391
exercise voice assistant
Dec 7, 2025
18265c7
Added API exercises
Dec 8, 2025
ece19d0
Revert Added API exercises
Dec 8, 2025
8d01d30
Added API exercises
Dec 8, 2025
e8b1c50
Deleted old files
Dec 8, 2025
c161d90
Updates diagrams
Dec 8, 2025
6cfe996
Merge pull request #10 from MonikaShaik/exercises-API
MonikaShaik Dec 9, 2025
3ea1847
Merge branch 'HackYourFuture-CPH:main' into main
MonikaShaik Mar 1, 2026
f732cde
Add veggies.txt with 5 vegetables
MonikaShaik Mar 3, 2026
0be9588
Replace 'pepper' with 'onion' in veggies list
MonikaShaik Mar 3, 2026
91b983c
Update veggies list
MonikaShaik Mar 3, 2026
a5f77e5
Merge remote-tracking branch 'origin/collaboration-via-github-week1/M…
MonikaShaik Mar 3, 2026
6a64dc4
Add function.exercise files
MonikaShaik Mar 26, 2026
3a45106
Add function as a variable.exercise file
MonikaShaik Mar 26, 2026
d0850cf
Add game.exercise files
MonikaShaik Mar 26, 2026
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: 13 additions & 0 deletions JavaScripHYF/exercise.smart-ease.index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>Test text</p>
<script src="exercise.smart-ease.js"></script>
</body>
</html>

148 changes: 148 additions & 0 deletions JavaScripHYF/exercise.smart-ease.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
//The full name exercise.
function getFullName(firstName, lastName,useFormalName ) {
let fullName =` ${firstName} ${lastName}`

return useFormalName ? `Lord ${fullName}` : fullName;

}

const fullName1 = getFullName("John", "Doe");
const fullName2 = getFullName("Jane", "Smith");

console.log(fullName1);
console.log(fullName2);

// Event application
function getEventWeekday(numberOfDaysFromToday) {
const today = new Date();
const targetDate = new Date(today);
targetDate.setDate(today.getDate() + numberOfDaysFromToday);

const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const weekday = weekdays[targetDate.getDay()];

return weekday;
}

console.log(getEventWeekday(9));

// Weather wear
function getWearByWeather(temperature) {
if (temperature < 0) {
return "Heavy winter coat, gloves, and a hat";
} else if (temperature >= 0 && temperature < 10) {
return "Winter jacket and warm layers";
} else if (temperature >= 10 && temperature < 18) {
return "Light jacket or sweater";
} else
return "Shorts and a t-shirt";
}

const clothesToWear = getWearByWeather(18);
console.log(clothesToWear);

//Student menager
const class07Students = [];

function addStudentToClass(studentName) {

if (studentName === 'Queen Mary') {
class07Students.push(studentName);
return;
}

if (class07Students.includes(studentName)) {
console.log(`Student ${studentName} is already in the class`);
return;
}

if (studentName=== '') {
console.log('You cannot add an empty name');
return;
}

if(class07Students.length >= 6) {
console.log('Cannot add more students to class 07');
return;
}


class07Students.push(studentName);

}

function getNumberOfStudents() {
return class07Students.length;
}

addStudentToClass('Alice');
addStudentToClass('Bob');
addStudentToClass('Charlie');
addStudentToClass('David');
addStudentToClass('Eve');
addStudentToClass('Frank');
addStudentToClass('Grace');
addStudentToClass('Queen Mary');
addStudentToClass('');
addStudentToClass('Alice');
addStudentToClass('Queen Mary');

console.log(getNumberOfStudents());

//Candy helper
const boughtCandyPrices = [];

function addCandy(candyType, weight){
let price;
if(candyType === "sweet"){
price = 0.5 * weight;
} else if(candyType === "chocolate"){
price = 0.7 * weight;
} else if(candyType === "toffee"){
price = 1.1 * weight;
} else if(candyType === "chewing-gum"){
price = 0.03 * weight;
}
boughtCandyPrices.push(price);

}

let amountToSpend = Math.random() * 100;

function canBuyMoreCandy(){
let totalSpent = 0;
for(let i = 0; i < boughtCandyPrices.length; i++){
totalSpent += boughtCandyPrices[i];
}
return totalSpent < amountToSpend;
}

addCandy("sweet", 10);
if(canBuyMoreCandy()){
console.log("You can buy more, so please do!");
}else{
console.log("Enough candy for you!");
}


addCandy("chocolate", 5);
if(canBuyMoreCandy()){
console.log("You can buy more, so please do!");
}else{
console.log("Enough candy for you!");
}

addCandy("toffee", 2);
if(canBuyMoreCandy()){
console.log("You can buy more, so please do!");
}else{
console.log("Enough candy for you!");
}

addCandy("chewing-gum", 50);
if(canBuyMoreCandy()){
console.log("You can buy more, so please do!");
}else{
console.log("Enough candy for you!");
}

177 changes: 177 additions & 0 deletions JavaScripHYF/exercise.voice-assistant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@

let userName = null;
let todos = [];

function getReply(command) {
console.log("Command received: ", command);

if (command.includes("hello my name is")) {
let words = command.split(" ");
let nameIndex = words.length - 1;
let name = words[nameIndex];

if (userName == name) {
return "Hi again " + userName;
}

userName = name;
return "Nice to meet you " + userName;
}

if (command.includes("what is my name")) {
if (userName) {
return userName;
} else {
return "I don't know your name";
}
}

if (command.includes("to my to do")) {
let todo = command.slice(4, -11)
todos.push(todo);
return `${todo} added to your todo`;
}

if (command.includes("from my todo")) {
let todo = command.slice(7, -1313);
let indexOfTodo = todos.indexOf(todo);
if (indexOfTodo !== -1) {
todos.splice(indexOfTodo, 1);
}

return `Removed ${todo} from your todo`;
}

if (command.includes("what is on my to do")) {
let numberOfItems = todos.length;
let responseSentence = `you have ${numberOfItems} todos - `;

for (let i = 0; i < todos.length; i++) {
if (todos.length > 1) {
responseSentence += `${todos[i]}, `;
} else {
responseSentence += `${todos[i]} `;
}
}
return responseSentence;
}

if (command.includes("what day is it today")) {
const date = new Date();
let day = date.getDate();

const monthNames = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];

let month = monthNames[date.getMonth()];

let year = date.getFullYear();

return `${day} of ${month} ${year}`;
}

if (command.includes("what is ")) {
let fullOperationSentence = command.slice(8);
let partsOfSentence = fullOperationSentence.split(" ");

let operatorSymbol = partsOfSentence[1];
let number1 = parseInt(partsOfSentence[0]);
let number2 = parseInt(partsOfSentence[2]);

let result;

switch (operatorSymbol) {
case "+":
result = number1 + number2;
break;

case "-":
result = number1 - number2;
break;

case "*":
result = number1 * number2;
break;

case "/":
result = number1 / number2;
break;

default:
break;
}

return result;
}

if (command.includes("set a timer for")) {
let timerSentence = command.slice(16);
let partsOfSentence = timerSentence.split(" ");
let number = parseInt(partsOfSentence[0]);
let duration = partsOfSentence[1]; // seconds, minutes, hours

let timerInMilliSeconds;

switch (duration) {
case "seconds":
timerInMilliSeconds = number * 1000;
break;

case "minutes":
timerInMilliSeconds = number * 1000 * 60;
break;

case "hours":
timerInMilliSeconds = number * 1000 * 60 * 60;
break;

default:
break;
}


function timerFunction() {
artyom.say("Timer Done");
}

setTimeout(timerFunction, timerInMilliSeconds);

return `Timer set for ${number} ${duration}`;
}

return "I didn't understand that command";
}

// getReply("hello my name is Monika");
// getReply("hello my name is Monika");
// getReply("hello my name is Benjamin");

// getReply("what is my name");

// getReply("add fishing to my todo");
// getReply("add singing in the shower to my todo");
// getReply("add boating to my todo");
// getReply("add watching TV to my todo");

// getReply("remove fishing from my todo");

// getReply("what is on my todo");

// getReply("what day is it today");

// getReply("what is 3 + 3");
// getReply("what is 4 * 12");

// getReply("set a timer for 5 seconds")
10 changes: 10 additions & 0 deletions JavaScripHYF/exercise.week3.index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script src="./exercise.week3.js"></script>
</body>
</html>
Loading