Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce137dc
Add basic command lines to control Git
lucy-semenova Oct 29, 2025
fb39364
Merge branch 'git-week1/exercise-3/Mila'
lucy-semenova Oct 29, 2025
cfd460d
Add favorite food recipes and countries list
lucy-semenova Oct 29, 2025
253ce38
index.html create About me page,style.css add font:merriweather, int…
lucy-semenova Nov 5, 2025
69f6a0b
Add file with a link to Trello
lucy-semenova Jan 20, 2026
691e59b
Add basic command lines to control Git
lucy-semenova Oct 29, 2025
9d856ef
create a structure
lucy-semenova Feb 8, 2026
3b26116
Add JS week1 exercises: Ez-Namey, Goodboy-Oldboy, Housey Pricey, Age…
lucy-semenova Nov 11, 2025
6bffac1
Add recipe-app-design.txt and recipe-app-design.jpg with diagrams
lucy-semenova Dec 8, 2025
db0dc70
Add Recipe-app-diagram.jpg with corrected diagram
lucy-semenova Dec 9, 2025
a9a61bf
Add database_assignment.sql
lucy-semenova Dec 16, 2025
cbe8209
Fix: update the file.
lucy-semenova Dec 17, 2025
f19e0b3
Fix: update file
lucy-semenova Dec 17, 2025
98ff592
Add js-week2-mila assignments
lucy-semenova Nov 19, 2025
be4de8b
Fix: update files
lucy-semenova Dec 22, 2025
29bc2c4
JS-week4-mila
lucy-semenova Dec 3, 2025
5029a30
Fix:update files
lucy-semenova Dec 22, 2025
1cd55bf
Fix:update file
lucy-semenova Dec 22, 2025
e987224
Add tasks 1-5 from js-week3
lucy-semenova Nov 26, 2025
e09f6ca
Fixed in accordance with comments, update the file JS3-hw.js
lucy-semenova Dec 9, 2025
bbce4ee
Merge pull request #10 from lucy-semenova/intro-to-agile
lucy-semenova Mar 4, 2026
425dfae
Merge pull request #1 from lucy-semenova/ai-week1-mila
lucy-semenova Mar 10, 2026
ae04ec8
Add movies project
lucy-semenova Mar 18, 2026
5652ad7
Add task1
lucy-semenova Mar 18, 2026
e2d514b
add JSadv-2 session exercises
lucy-semenova Mar 23, 2026
e56f7bf
add task3
lucy-semenova Mar 23, 2026
1d02bf4
Add Task2,3,4 folders with files
lucy-semenova Mar 25, 2026
1e4dd68
Add currencyCalculator files
lucy-semenova Apr 1, 2026
c7dfec0
Create screenshot generator app HTML structure
lucy-semenova Apr 13, 2026
feb2f81
init: add initial styles
lucy-semenova Apr 13, 2026
dce7bd3
feat:add error handling and validation for screenshot saving
lucy-semenova Apr 15, 2026
7317647
feat:add function to capture screenshot
lucy-semenova Apr 15, 2026
13a6429
refactor:move error handling in separate module
lucy-semenova Apr 15, 2026
2d85450
feat:add Screenshot class with renderPreview and renderSavedCard methods
lucy-semenova Apr 15, 2026
357f293
feat: finalize app with screenshot saving, UI improvements and README
lucy-semenova Apr 17, 2026
e86f439
fix: handle 413 error correctly and improve error messages
lucy-semenova Apr 20, 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
File renamed without changes.
262 changes: 262 additions & 0 deletions JS3-hw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
//#1 Item array removal

const names = [
"Peter",
"Ahmad",
"Yana",
"kristina",
"Rasmus",
"Samuel",
"Katrine",
"Tala",
];

const nameToRemove = names.indexOf("Ahmad");
if (nameToRemove !== -1) {
names.splice(nameToRemove, 1);
}

console.log(names);

//#2 Calculate time to reach the destination in minutes

const travelInformation = {
speed: 50,
destinationDistance: 432,
};

function calculateTravelTimeInMinutes(distance, speed) {
return (distance/speed) * 60;
};

console.log(
calculateTravelTimeInMinutes(
travelInformation.destinationDistance,
travelInformation.speed
)
);



const travelTimeInMinutes = calculateTravelTimeInMinutes(
travelInformation.destinationDistance,
travelInformation.speed
);

//Converted minutes into hours and minutes

function calculateTravelTimeInHoursAndMinutes(totalMinutes) {
if (totalMinutes < 60) {
return `${totalMinutes} minutes`;
}
const hours = Math.floor(totalMinutes / 60);
const minutes = Math.round(totalMinutes % 60);
return `${hours} hours ${minutes} minutes`;
}
console.log(calculateTravelTimeInHoursAndMinutes(travelTimeInInMinutes)
); // 8 hours and 38 minutes

//#3 Series duration of my life

const seriesDurations = [
{
title: "Lost",
days: 3,
hours: 16,
minutes: 30,
},
{
title: "The Residence",
days: 0,
hours: 7,
minutes: 44,
},
{
title: "The The Queen's Gambit",
days: 0,
hours: 6,
minutes: 32,
},
];

//Calculate total series duration in minutes

let totalSeriesDurationInMinutes = 0;

for (const duration of seriesDurations) {
totalSeriesDurationInMinutes +=((duration.days*24*60)+(duration.hours *60)+duration.minutes);
}

console.log(totalSeriesDurationInMinutes);

// Convert Life span into minutes

function convertLifeSpanYearsIntoMinutes(years) {
return (years*525600);//1 year = 525600 minutes
}

//Ask for age
let lifeSpanInYears = prompt("How old are you?");
lifeSpanInYears = Number(lifeSpanInYears);

function validateLifeSpanInput(lifeSpanInYears) {
if (isNaN(lifeSpanInYears) || lifeSpanInYears === "" || lifeSpanInYears == null) {
console.log("Please enter a valid number.");
return;
}

const lifeSpanInMinutes = convertLifeSpanYearsIntoMinutes(lifeSpanInYears);

//Calculate series duration as a percentage of life span
function seriesDurationsOutOfLifeSpan(seriesMinutes, lifeSpanMinutes) {
return (seriesMinutes/lifeSpanMinutes) * 100;
};

console.log(
"Series duration as percentage of life span:",
seriesDurationsOutOfLifeSpan(
totalSeriesDurationInMinutes,
lifeSpanInMinutes
).toFixed(2) + "%"
);


//#4 Note taking app

//Save a note

let notes = [];

function saveNote(content, id) {
if (content.trim() !== "") {
notes.push({ id, content })
}
}

saveNote("Pick up groceries", 1);
saveNote("Do laundry", 2);

console.log("Current notes:", notes);

//Get a note by id

function getNote(id){
//Check if id is missing or not a number
if (id === undefined ||
typeof id !== "number") {
console.log("Error");
return;
}
//Loop to find the note with the id
for (let i = 0; i < notes.length; i++) {
if (notes[i].id === id) {
return notes[i]; // return the note object
}
}
//If the id is not found
return "Not found";
}

const firstNote = getNote(1);
console.log(firstNote); // {content: 'Pick up groceries', id: 1}

//Log out notes

function logOutNotesFormatted() {
for (let note of notes) {
console.log(`The note with id: ${note.id}, has the following note text:${note.content}`);
}
}

logOutNotesFormatted();

//Delete a note

//Keep undeleted notes
function deleteNote(id) {
let newNotes = [];
for (let i = 0; i < notes.length; i++) {
if (notes[i].id !== id) {
newNotes.push(notes[i]);
}
}
notes = newNotes;


}

//#5 Adding an activity

let activities = [
{
date: '23/7-18',
activity: 'Youtube',
duration: 30,
},
{
date: '24/7-18',
activity: 'Instagram',
duration: 40,
},
{
date: '25/7-18',
activity: 'Facebook',
duration: 50,
}
];

function addActivities(date, activity, duration) {
activities.push({
date: date,
activity: activity,
duration: duration
});
}

addActivities('26/7-18', 'Twitter', 10);
console.log(activities);


//Calculate total Activity Duration

function getTotalDuration() {

let totalActivitiesDurationInMinutes = 0;

for (const activity of activities) {
totalActivitiesDurationInMinutes += activity.duration;
}
return totalActivitiesDurationInMinutes;
}

//Show my status

function showStatus() {
const totalActivitiesDurationInMinutes = getTotalDuration();

if (totalActivitiesDurationInMinutes === 0) {
return("Add some activities before calling showStatus");
}

return (`You have added ${activities.length} activities. They amount to ${totalActivitiesDurationInMinutes} min. of usage.`)
}
JS
console.log(showStatus());


//Usage limit

let timeToUseSmartphone = Number(prompt("How long can you use the smartphone?"));

timeToUseSmartphone = Number(timeToUseSmartphone);

function canUseMoreSmartphone(timeLimit, totalActivitiesDurationInMinutes) {

if (totalActivitiesDurationInMinutes < timeLimit) {
console.log("You can use the smartphone!");
} else {
console.log("You have reached your limit, no more smartphoning for you!")
}
}

canUseMoreSmartphone(timeToUseSmartphone, getTotalDuration());
12 changes: 12 additions & 0 deletions JS4 HW/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS4-HW</title>
</head>
<body>
<h1>Hello</h1>
<script src="index.js"></script>
</body>
</html>
119 changes: 119 additions & 0 deletions JS4 HW/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
const userName = "";

const todoList = [];

function getReply(command = "") {

if (command.toLowerCase().includes("hello my name is")) {
const userName = command.split(" ").pop();
return `Nice to meet you ${userName} `;
}

if (command.toLowerCase().includes("what is my name?")) {
if (userName != "") {
return (`Your name is ${userName}`)
} else {
return ("Please, introduce yourself")
};
}

if ((command.toLowerCase().includes("todo")) &&
command.toLowerCase().includes("add")) {
const task = (command.substring("add ".length, command.length - " to my todo".length));
todoList.push(task);
return `${task} added to your todo`;
}

if (command.toLowerCase().includes("what is on my todo")) {
return todoList;
}

if ((command.toLowerCase().includes("todo")) &&
(command.toLowerCase().includes("remove"))) {
const taskToRemove = command.substring("remove ".length, command.length - " from my todo".length);
if (todoList.includes(taskToRemove)) {
return "Removed " + todoList.splice(todoList.indexOf(taskToRemove), 1) + " from your todo";
} else {
return "There is no such activity in todo."+ (todoList.indexOf(taskToRemove));
}
}

if ((command.includes("+")) ||
(command.includes("-")) ||
(command.includes("*")) ||
(command.includes("/"))) {
const mathExpression = command.split(" ");

if (mathExpression.length !== 3) {
return "Invalid math expression";
}
const a = Number(mathExpression[0]);
const operator = mathExpression[1];
const b = Number(mathExpression[2]);

if (Number.isNaN(a) && Number.isNaN(b)) {
return "Invalid numbers in expression";
}
switch (operator) {
case "+":
return a + b;
break;

case "-":
return a - b;
break;

case "/":
if (b === 0) {
return "Division by zero is not allowed";
}
return a / b;
break;

case "*":
return a * b;
}
}

if (command.toLowerCase().includes("what day is it today")) {
//respond with the date in a human readable format. ;
const date = new Date();
return date.getDate()+ " of " + date.toLocaleString('default', { month: 'long' }) + " " + date.getFullYear();
}

if (command.toLowerCase().includes("set a timer for")) {
const timeString = command.substring("set a timer for ".length, command.length - " minutes".length);
const time = Number(timeString);
return `Timer set for ${time} minutes`;
}

return ("Sorry, command is not recognized.");
}

console.log("What is my name?");
console.log(getReply("What is my name?"));
console.log("Hello my name is Benjamin");
console.log(getReply("Hello my name is Benjamin"));
console.log("What is my name?")
console.log(getReply("What is my name?"));
console.log("Add fishing to my todo");
console.log(getReply("Add fishing to my todo"));
console.log("Add singing in the shower to my todo");
console.log(getReply("Add singing in the shower to my todo"));
console.log("Add shopping to my todo");
console.log(getReply("Add shopping to my todo"));
console.log("What is on my todo?");
console.log(getReply("What is on my todo?"));
console.log("Remove fishing from my todo");
console.log(getReply("Remove fishing from my todo"));
console.log("Remove singing in the shower from my todo");
console.log(getReply("Remove singing in the shower from my todo"));
console.log("What is on my todo?");
console.log(getReply("What is on my todo?"));
console.log("What day is it today?");
console.log(getReply("What day is it today?"));
console.log("Set a timer for 5 minutes");
console.log(getReply("Set a timer for 4 minutes"));
console.log(getReply());
console.log("3 + 3");
console.log(getReply("3 + 3"));
Binary file added Recipe-app-diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added ai-week1-mila/README.md
Empty file.
Loading