diff --git a/JavaScripHYF/exercise.smart-ease.index.html b/JavaScripHYF/exercise.smart-ease.index.html
new file mode 100644
index 000000000..e3ee9766b
--- /dev/null
+++ b/JavaScripHYF/exercise.smart-ease.index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+ Document
+
+
+ Test text
+
+
+
+
diff --git a/JavaScripHYF/exercise.smart-ease.js b/JavaScripHYF/exercise.smart-ease.js
new file mode 100644
index 000000000..f25d1a6f2
--- /dev/null
+++ b/JavaScripHYF/exercise.smart-ease.js
@@ -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!");
+}
+
diff --git a/JavaScripHYF/exercise.voice-assistant.js b/JavaScripHYF/exercise.voice-assistant.js
new file mode 100644
index 000000000..2935607da
--- /dev/null
+++ b/JavaScripHYF/exercise.voice-assistant.js
@@ -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")
\ No newline at end of file
diff --git a/JavaScripHYF/exercise.week3.index.html b/JavaScripHYF/exercise.week3.index.html
new file mode 100644
index 000000000..31f80d56d
--- /dev/null
+++ b/JavaScripHYF/exercise.week3.index.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Document
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaScripHYF/exercise.week3.js b/JavaScripHYF/exercise.week3.js
new file mode 100644
index 000000000..cdf4c8660
--- /dev/null
+++ b/JavaScripHYF/exercise.week3.js
@@ -0,0 +1,143 @@
+//Item array removal
+
+const names = [
+ "Peter",
+ "Ahmad",
+ "Yana",
+ "kristina",
+ "Rasmus",
+ "Samuel",
+ "Katrine",
+ "Tala",
+];
+const nameToRemove = "Ahmad";
+
+// Write some code here
+let index = names.indexOf(nameToRemove);
+if (index > 0) {
+ names.splice(index, 1);
+}
+// Code done
+
+console.log(names); // ['Peter', 'Yana', 'kristina', 'Rasmus', 'Samuel', 'Katrine', 'Tala']
+
+
+//Speed and distance
+
+const travelInformation = {
+ speed: 50,
+ destinationDistance: 432,
+};
+
+function calculateTravelTime(travelInformation) {
+ let time = travelInformation.destinationDistance / travelInformation.speed;
+ let hours = Math.floor(time);
+ let minutes = Math.round((time - hours) * 60);
+ return `${hours} hours and ${minutes} minutes`;
+}
+
+const travelTime = calculateTravelTime(travelInformation);
+console.log(travelTime);
+
+
+//Series duration...
+const seriesDurations = [
+ {
+ title: "Modern Family",
+ days: 5,
+ hours: 9,
+ minutes: 15,
+ },
+ {
+ title: "Next gen chef",
+ days: 10,
+ hours: 23,
+ minutes: 55,
+ },
+ {
+ title: "The night agent",
+ days: 10,
+ hours: 17,
+ minutes: 47,
+ },
+];
+
+function logOutSeriesText(seriesDurations) {
+
+ const lifeInMinutes = 80 * 365 * 24 * 60;
+
+ seriesDurations.forEach((series) => {
+
+ const seriesMinutes =
+ series.days * 24 * 60 + series.hours * 60 + series.minutes;
+
+ const totalPercentage = ((seriesMinutes / lifeInMinutes) * 100);
+
+ console.log(`${series.title} took ${totalPercentage.toFixed()}% of my life`);
+ });
+}
+
+logOutSeriesText(seriesDurations);
+
+
+//Note taking app
+
+let notes = [];
+
+function saveNote(content, id) {
+ notes.push({ content: content, id: id });
+}
+
+function getNote(id) {
+ return notes.find((note) => note.id === id);
+}
+
+function logOutNotesFormatted() {
+ notes.forEach((note) => {
+ console.log(`The note with id: ${note.id}, has the following note text: ${note.content}`);
+ });
+}
+
+
+//Smartphone usage app
+
+let activities = [];
+
+function addActivity(date, activity, duration) {
+ activities.push({ date: date, activity: activity, duration: duration });
+}
+
+function showStatus(activities) {
+
+ let activitiesNumber = activities.length;
+ let totalDuration = 0;
+ const usageLimit = 100;
+
+ for (let i = 0; i < activities.length; i++) {
+ totalDuration += activities[i].duration;
+ }
+
+ if (activitiesNumber === 0) {
+ console.log("Add some activities before calling showStatus");
+ return;
+ }
+
+ if (totalDuration > usageLimit) {
+ return "You have reached your limit, no more smartphoning for you!";
+ }
+
+ return `You have added ${activitiesNumber} activities. They amount to ${totalDuration} min. of usage`;
+
+}
+
+showStatus(activities);
+
+addActivity("2024-06-01", "Facebook", 35);
+addActivity("2024-06-01", "Instagram", 20);
+showStatus(activities);
+
+addActivity("2024-06-02", "YouTube", 200);
+showStatus(activities);
+
+
+
diff --git a/JavaScripHYF/exercise1.index.html b/JavaScripHYF/exercise1.index.html
new file mode 100644
index 000000000..31aaa9bed
--- /dev/null
+++ b/JavaScripHYF/exercise1.index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Age calculator
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaScripHYF/exercise1.js b/JavaScripHYF/exercise1.js
new file mode 100644
index 000000000..7c19dd449
--- /dev/null
+++ b/JavaScripHYF/exercise1.js
@@ -0,0 +1,65 @@
+// Age Calculator
+let yearOfBirth = 1990;
+let yearFuture = 2190;
+let age = yearFuture - yearOfBirth;
+console.log("You will be " + age + " years old in " + yearFuture);
+
+// Dog Age Calculator
+let dogYearOfBirth = 2023;
+let dogYearFuture = 2026;
+let dogYear = dogYearFuture - dogYearOfBirth;
+let shouldShowResultInDogYears = true;
+
+if (shouldShowResultInDogYears) {
+ let ageInDogYears = dogYear * 7;
+ console.log("Your dog will be " + ageInDogYears + " dog years old in " + dogYearFuture);
+} else {
+ console.log("Your dog will be " + dogYear + " human years old in " + dogYearFuture);
+}
+
+// House Price Calculator
+housePrise = volumeInMeters = 2.5 * 1000 + gardenSizeInM2 * 300;
+
+let peterWidth = 8;
+let peterDepth = 10;
+let peterHeight = 10;
+let peterGardenSizeInM2 = 100;
+let peterHousePrice = 2500000;
+let peterVolumeInMeters = peterWidth * peterDepth * peterHeight;
+let peterCalculatedPrice = peterVolumeInMeters * 2.5 * 1000 + peterGardenSizeInM2 * 300;
+
+if (peterCalculatedPrice < peterHousePrice) {
+ console.log("Peter is paying too much.");
+} else if (peterCalculatedPrice > peterHousePrice) {
+ console.log("Peter is paying too little.");
+} else {
+ console.log("Peter is paying the correct price.");
+}
+
+let juliaWidth = 5;
+let juliaDepth = 11;
+let juliaHeight = 8;
+let juliaGardenSizeInM2 = 70;
+let juliaHousePrice = 1000000;
+let juliaVolumeInMeters = juliaWidth * juliaDepth * juliaHeight;
+let juliaCalculatedPrice = juliaVolumeInMeters * 2.5 * 1000 + juliaGardenSizeInM2 * 300;
+
+if (juliaCalculatedPrice < juliaHousePrice) {
+ console.log("Julia is paying too much.");
+} else if (juliaCalculatedPrice > juliaHousePrice) {
+ console.log("Julia is paying too little.");
+} else {
+ console.log("Julia is paying the correct price.");
+}
+
+// Startup name generator
+let firstWords = ["Easy", "Awesome", "Corporate", "Red", "Blue", "Green", "Big", "Smart", "Nice", "Super"];
+let secondWords = ["App", "Solution", "Tech", "Systems", "Code", "Web", "Works", "Corp", "Data", "Cloud"];
+
+let randomIndex = Math.floor(Math.random() * 10);
+let startupName = firstWords[randomIndex] + " " + secondWords[randomIndex];
+let startupNameLength = startupName.length;
+
+console.log("The startup: " + startupName + " contains " + startupNameLength + " characters.");
+
+
diff --git a/JavaScripHYF/exercises.API/Architecture- diagram.png b/JavaScripHYF/exercises.API/Architecture- diagram.png
new file mode 100644
index 000000000..b6a641500
Binary files /dev/null and b/JavaScripHYF/exercises.API/Architecture- diagram.png differ
diff --git a/JavaScripHYF/exercises.API/Diagram-edit recipe.png b/JavaScripHYF/exercises.API/Diagram-edit recipe.png
new file mode 100644
index 000000000..e3bd140c3
Binary files /dev/null and b/JavaScripHYF/exercises.API/Diagram-edit recipe.png differ
diff --git a/JavaScripHYF/exercises.API/Diagram-new recipe.png b/JavaScripHYF/exercises.API/Diagram-new recipe.png
new file mode 100644
index 000000000..68f564bec
Binary files /dev/null and b/JavaScripHYF/exercises.API/Diagram-new recipe.png differ
diff --git a/JavaScripHYF/exercises.API/Diagram-specific recipe.png b/JavaScripHYF/exercises.API/Diagram-specific recipe.png
new file mode 100644
index 000000000..1ef8e0962
Binary files /dev/null and b/JavaScripHYF/exercises.API/Diagram-specific recipe.png differ
diff --git a/JavaScripHYF/exercises.API/exercise.Identify...txt b/JavaScripHYF/exercises.API/exercise.Identify...txt
new file mode 100644
index 000000000..d0a3ba85e
--- /dev/null
+++ b/JavaScripHYF/exercises.API/exercise.Identify...txt
@@ -0,0 +1,17 @@
+
+Data storage:
+Recipes are stored in a database (e.g. SQL or NoSQL) managed by the backend. Database has Recipes table which stores many recipes. Each recipe has fields like id, title, ingredients, instructions, etc.
+
+Frontend–backend communication:
+The frontend communicates with the backend via REST API using HTTP requests, for example:
+* GET /recipes – get all recipes
+* GET /recipes/:id – get one recipe
+* POST /recipes – create a recipe
+* PUT /recipes/:id – update a recipe
+* DELETE /recipes/:id – delete a recipe
+
+When a user adds a new recipe:
+1. User fills and submits a form in the frontend.
+2. Frontend sends a POST /recipes request with recipe data in JSON.
+3. Backend validates and saves the recipe in the database, then returns the created recipe (with id).
+4. Frontend updates the UI (e.g. adds the new recipe to the list or redirects to its detail view).
diff --git a/JavaScripHYF/intro-to-be/backend-exercise.js b/JavaScripHYF/intro-to-be/backend-exercise.js
new file mode 100644
index 000000000..ddda272be
--- /dev/null
+++ b/JavaScripHYF/intro-to-be/backend-exercise.js
@@ -0,0 +1,141 @@
+import express from "express";
+import knex from "knex";
+import path from "path";
+
+const app = express();
+const port = 3000;
+
+
+// This connects to the database stored in the file mentioned below
+const knexInstance = knex({
+ client: "sqlite3",
+ connection: {
+ filename: "./database.sqlite3",
+ },
+ useNullAsDefault: true, // Omit warning in console
+});
+
+app.get("/", async (req, res) => {
+
+ const rows = await knexInstance.raw("SELECT COUNT(*) AS count FROM users;");
+ const count = rows[0].count;
+
+ res.setHeader('Content-Type', 'text/html')
+ res.send(`
+
+
+
+
+ User-count
+
+
+
+
+
+
Total Users
+ ${count}
+
+
+
+`)
+});
+
+// 1. Here is an example of the first route, /all-users, which returns all users sorted by their ID
+app.get("/all-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 2. Route for /unconfirmed-users
+app.get("/unconfirmed-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users WHERE confirmed_at is NULL ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 3. Route for /gmail-users
+app.get("/gmail-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users WHERE email LIKE '%@gmail.com' ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 4. Route for /2022-users
+app.get("/2022-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users WHERE created_at LIKE '2022%' ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 5. Route for /user-count
+app.get("/user-count", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT COUNT(*) AS count FROM users;");
+ res.json(rows);
+});
+
+
+// 6. Route for /last-name-count
+app.get("/last-name-count", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT last_name, COUNT(*) AS user_count FROM users GROUP BY last_name ORDER BY last_name ASC;");
+ res.json(rows);
+});
+
+// 7. Route for /first-user
+app.get("/first-user", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users");
+ if (rows.length > 0) {
+ res.json(rows[0]);
+ } else {
+ res.status(404).json({ error: "User not found" });
+ }
+});
+
+// TODO implement more routes here
+
+// 8. Route for /confirmed-users
+app.get("/confirmed-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users WHERE confirmed_at is not NULL ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 9. Route for /non-customdomain-users
+app.get("/non-customdomain-users", async (req, res) => {
+ const rows = await knexInstance.raw("SELECT * FROM users WHERE email not LIKE '%@customdomain.com' ORDER BY id ASC;");
+ res.json(rows);
+});
+
+// 10. Route for /get-users-by-joined-year
+app.get("/get-users-by-joined-year", async (req, res) => {
+ const year = req.query.year
+
+ const query = `SELECT * FROM users WHERE created_at LIKE '${year}%' ORDER BY id ASC`;
+
+ const result = await await knexInstance.raw(query)
+ res.json(result);
+
+});
+
+app.listen(port, () => {
+ console.log(`Listening on port ${port}`);
+});
+