diff --git a/Sprint-2/debug/address.js b/Sprint-2/debug/address.js
index 940a6af83..c1d871fcc 100644
--- a/Sprint-2/debug/address.js
+++ b/Sprint-2/debug/address.js
@@ -12,4 +12,5 @@ const address = {
postcode: "XYZ 123",
};
-console.log(`My house number is ${address[0]}`);
+
+houseNumber: (42, console.log(`My house number is ${address.houseNumber}`));
diff --git a/Sprint-2/debug/author.js b/Sprint-2/debug/author.js
index 8c2125977..be6d90aac 100644
--- a/Sprint-2/debug/author.js
+++ b/Sprint-2/debug/author.js
@@ -2,7 +2,7 @@
// This program attempts to log out all the property values in the object.
// But it isn't working. Explain why first and then fix the problem
-
+// using the key word "Object.velues" and assigning it to a variable passes only the values to the Object
const author = {
firstName: "Zadie",
lastName: "Smith",
@@ -10,7 +10,5 @@ const author = {
age: 40,
alive: true,
};
-
-for (const value of author) {
- console.log(value);
-}
+let details = Object.values(author);
+console.log(details);
diff --git a/Sprint-2/debug/recipe.js b/Sprint-2/debug/recipe.js
index 6cbdd22cd..01c9447c6 100644
--- a/Sprint-2/debug/recipe.js
+++ b/Sprint-2/debug/recipe.js
@@ -3,6 +3,7 @@
// This program should log out the title, how many it serves and the ingredients.
// Each ingredient should be logged on a new line
// How can you fix it?
+// The recipe is an object so it needs to be in square brackets to be call each element by its key and index.
const recipe = {
title: "bruschetta",
@@ -10,6 +11,9 @@ const recipe = {
ingredients: ["olive oil", "tomatoes", "salt", "pepper"],
};
-console.log(`${recipe.title} serves ${recipe.serves}
+console.log(` ${recipe.title}
+ serves ${recipe.serves}
ingredients:
-${recipe}`);
+ ${recipe.ingredients.join("\n ")}
+
+ `);
diff --git a/Sprint-2/implement/contains.js b/Sprint-2/implement/contains.js
index cd779308a..bf2311dcf 100644
--- a/Sprint-2/implement/contains.js
+++ b/Sprint-2/implement/contains.js
@@ -1,3 +1,13 @@
-function contains() {}
+function contains(inPut, content) {
+ try {
+ console.log(inPut.hasOwnProperty(content));
+ return inPut.hasOwnProperty(content);
+ } catch (error) {
+ console.error(error);
+ }
+}
+console.log(contains({ a: 1, b: 2 }, "a"));
+console.log(contains({}, 9));
+// console.log(contains([a, 1, b, 2], "a"));
module.exports = contains;
diff --git a/Sprint-2/implement/contains.test.js b/Sprint-2/implement/contains.test.js
index 326bdb1f2..9b0fcf2b3 100644
--- a/Sprint-2/implement/contains.test.js
+++ b/Sprint-2/implement/contains.test.js
@@ -20,16 +20,49 @@ as the object doesn't contains a key of 'c'
// Given an empty object
// When passed to contains
// Then it should return false
-test.todo("contains on empty object returns false");
+test("contains on empty object returns false", () => {
+ expect(contains({}, "c")).toEqual(false);
+});
// Given an object with properties
// When passed to contains with an existing property name
// Then it should return true
+test("contains correct object returns true", () => {
+ expect(contains({ a: 4, b: 3, c: 9 }, "c")).toEqual(true);
+ expect(contains({ a: 4, b: 3, c: 9 }, "a")).toEqual(true);
+ expect(
+ contains(
+ { ant: "in your pants", bee: "in your bonnet", cats: "pajamas" },
+ "bee"
+ )
+ ).toEqual(true);
+ expect(contains({ aa: "cars", ba: "baracus", cdeez: "nope" }, "ba")).toEqual(
+ true
+ );
+});
// Given an object with properties
// When passed to contains with a non-existent property name
// Then it should return false
+test("contains incorrect object returns false", () => {
+ expect(contains({ a: 4, b: 3, c: 9 }, "d")).toEqual(false);
+ expect(contains({ a: 4, b: 3, c: 9 }, "8")).toEqual(false);
+ expect(
+ contains(
+ { ant: "in your pants", bee: "in your bonnet", cats: "pajamas" },
+ "wasp"
+ )
+ ).toEqual(false);
+ expect(
+ contains({ aa: "cars", ba: "baracus", cdeez: "nope" }, "Hanable Smith")
+ ).toEqual(false);
+});
// Given invalid parameters like an array
// When passed to contains
// Then it should return false or throw an error
+test("contains incorrect object type returns false", () => {
+ expect(contains([], "d")).toBe(false);
+ expect(contains("h", "d")).toBe(false);
+ expect(contains(9, "d")).toBe(false);
+});
diff --git a/Sprint-2/implement/lookup.js b/Sprint-2/implement/lookup.js
index a6746e07f..11d56c637 100644
--- a/Sprint-2/implement/lookup.js
+++ b/Sprint-2/implement/lookup.js
@@ -1,5 +1,13 @@
-function createLookup() {
- // implementation here
+function createLookup(countryAndCurrency) {
+ // const money = new Map(countryAndCurrency);
+ const cash = Object.fromEntries(countryAndCurrency);
+ // console.log(cash);
+ console.log(countryAndCurrency);
+ return cash;
}
+createLookup([
+ ["US", "USD"],
+ ["CA", "CAD"],
+]);
module.exports = createLookup;
diff --git a/Sprint-2/implement/lookup.test.js b/Sprint-2/implement/lookup.test.js
index 547e06c5a..ec860860e 100644
--- a/Sprint-2/implement/lookup.test.js
+++ b/Sprint-2/implement/lookup.test.js
@@ -1,6 +1,12 @@
const createLookup = require("./lookup.js");
-
-test.todo("creates a country currency code lookup for multiple codes");
+test("contains correct object returns true", () => {
+ expect(
+ createLookup([
+ ["US", "USD"],
+ ["CA", "CAD"],
+ ])
+ ).toEqual({ US: "USD", CA: "CAD" });
+});
/*
diff --git a/Sprint-2/implement/package.json b/Sprint-2/implement/package.json
new file mode 100644
index 000000000..30e709f56
--- /dev/null
+++ b/Sprint-2/implement/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "implement",
+ "description": "coureswork",
+ "devDependencies": {
+ "jest": "^30.2.0"
+ },
+ "scripts": {
+ "test": "jest"
+ }
+}
diff --git a/Sprint-2/implement/querystring.js b/Sprint-2/implement/querystring.js
index 45ec4e5f3..be44f7ad6 100644
--- a/Sprint-2/implement/querystring.js
+++ b/Sprint-2/implement/querystring.js
@@ -1,16 +1,24 @@
function parseQueryString(queryString) {
const queryParams = {};
- if (queryString.length === 0) {
+ if (queryString === undefined || queryString.length === 0) {
return queryParams;
}
const keyValuePairs = queryString.split("&");
for (const pair of keyValuePairs) {
- const [key, value] = pair.split("=");
+ const cutOff = pair.indexOf("=");
+ const key = pair.slice(0, cutOff);
+ const value = pair.slice(cutOff + 1, pair.length);
queryParams[key] = value;
+ console.log(key);
+ console.log(value);
}
return queryParams;
}
+console.log(parseQueryString("y=8&r=y"));
+console.log(parseQueryString("equation=x=y+1"));
+console.log(parseQueryString("="));
+console.log(parseQueryString("abcdefghijk"));
module.exports = parseQueryString;
diff --git a/Sprint-2/implement/querystring.test.js b/Sprint-2/implement/querystring.test.js
index 3e218b789..09a4e6e30 100644
--- a/Sprint-2/implement/querystring.test.js
+++ b/Sprint-2/implement/querystring.test.js
@@ -3,10 +3,23 @@
// Below is one test case for an edge case the implementation doesn't handle well.
// Fix the implementation for this test, and try to think of as many other edge cases as possible - write tests and fix those too.
-const parseQueryString = require("./querystring.js")
+const parseQueryString = require("./querystring.js");
test("parses querystring values containing =", () => {
expect(parseQueryString("equation=x=y+1")).toEqual({
- "equation": "x=y+1",
+ equation: "x=y+1",
});
+ expect(parseQueryString("FIVE=5")).toEqual({
+ FIVE: "5",
+ });
+ expect(parseQueryString("equation=x4=y+1")).toEqual({
+ equation: "x4=y+1",
+ });
+});
+
+test("Test for a null/empty string", () => {
+ expect(parseQueryString("")).toEqual({});
+
+ expect(parseQueryString("=")).toEqual({});
+ expect(parseQueryString("abc").toBe({}));
});
diff --git a/Sprint-2/implement/tally.js b/Sprint-2/implement/tally.js
index f47321812..bdec2187a 100644
--- a/Sprint-2/implement/tally.js
+++ b/Sprint-2/implement/tally.js
@@ -1,3 +1,25 @@
-function tally() {}
+function tally(arr) {
+ check = arr.constructor === Array;
+ try {
+ if (check !== true) {
+ throw new Error("input requires an array");
+ }
+ let count = {};
+ for (let letters of arr) {
+ if (count[letters]) {
+ count[letters]++;
+ } else {
+ count[letters] = 1;
+ }
+ }
+
+ console.log(arr);
+ return count;
+ } catch (e) {
+ return e.message;
+ }
+}
+
+console.log(tally({ 6: 7 }));
module.exports = tally;
diff --git a/Sprint-2/implement/tally.test.js b/Sprint-2/implement/tally.test.js
index 2ceffa8dd..a71f28eb7 100644
--- a/Sprint-2/implement/tally.test.js
+++ b/Sprint-2/implement/tally.test.js
@@ -19,16 +19,59 @@ const tally = require("./tally.js");
// Given a function called tally
// When passed an array of items
// Then it should return an object containing the count for each unique item
+test("tally on an empty array returns an empty object", () => {
+ expect(tally(["apples", "bananas", "apples", "orange", "bananas"])).toEqual({
+ apples: 2,
+ bananas: 2,
+ orange: 1,
+ });
+ expect(tally(["ants", "bear", "ants", "antalope"])).toEqual({
+ ants: 2,
+ bear: 1,
+ antalope: 1,
+ });
+ expect(tally([4, 4, 3, 2, 2, 2, 2, "cat"])).toEqual({
+ 4: 2,
+ 3: 1,
+ 2: 4,
+ cat: 1,
+ });
+});
// Given an empty array
// When passed to tally
// Then it should return an empty object
-test.todo("tally on an empty array returns an empty object");
+test("tally on an empty array returns an empty object", () => {
+ expect(tally([])).toEqual({});
+});
// Given an array with duplicate items
// When passed to tally
// Then it should return counts for each unique item
+test("tally it should return counts for each unique item", () => {
+ expect(tally(["armadillos", "boa_constrictor", "armadillos"])).toEqual({
+ armadillos: 2,
+ boa_constrictor: 1,
+ });
+ expect(tally(["ants", "bear", "ants", "antalope"])).toEqual({
+ ants: 2,
+ bear: 1,
+ antalope: 1,
+ });
+ expect(tally([4, 4, 3, 2, 2, 2, 2, "cat"])).toEqual({
+ 4: 2,
+ 3: 1,
+ 2: 4,
+ cat: 1,
+ });
+});
// Given an invalid input like a string
// When passed to tally
// Then it should throw an error
+test("When given an input other than an array", () => {
+ expect(tally("feet")).toBe("input requires an array");
+ expect(tally(67)).toBe("input requires an array");
+ expect(tally(true)).toBe("input requires an array");
+ expect(tally({ 3: 4 })).toBe("input requires an array");
+});
diff --git a/Sprint-2/interpret/invert.js b/Sprint-2/interpret/invert.js
index bb353fb1f..485d4d76f 100644
--- a/Sprint-2/interpret/invert.js
+++ b/Sprint-2/interpret/invert.js
@@ -6,24 +6,42 @@
// E.g. invert({x : 10, y : 20}), target output: {"10": "x", "20": "y"}
-function invert(obj) {
- const invertedObj = {};
+// function invert(obj) {
+// const invertedObj = {};
- for (const [key, value] of Object.entries(obj)) {
- invertedObj.key = value;
- }
+// for (const [key, value] of Object.entries(obj)) {
+// invertedObj.key = value;
+// }
- return invertedObj;
-}
+// return invertedObj;
+// }
+// console.log(invert({ a: 1, b: 2 }));
// a) What is the current return value when invert is called with { a : 1 }
+// it only returns { key: 1 }.
// b) What is the current return value when invert is called with { a: 1, b: 2 }
+// it only returns 2 because the loop continues and rewrights the key
// c) What is the target return value when invert is called with {a : 1, b: 2}
+// it should return { "1": "a", "2": "b" }
+
+// d) What does Object.entries return? Why is it needed in this program
+// Object.entries returns the key, value pairs for the object it is given.
+
+// e) Explain why the current return value is different from the target output
+// The invertedObj.key = value; is using the literal string "key" as its key instead of the variable key
-// c) What does Object.entries return? Why is it needed in this program?
+// f) Fix the implementation of invert (and write tests to prove it's fixed!)
-// d) Explain why the current return value is different from the target output
+function invert(obj) {
+ const invertedObj = {};
+
+ for (const [key, value] of Object.entries(obj)) {
+ invertedObj[value] = key;
+ }
+
+ return invertedObj;
+}
-// e) Fix the implementation of invert (and write tests to prove it's fixed!)
+module.exports = invert;
diff --git a/Sprint-2/interpret/invert.test.js b/Sprint-2/interpret/invert.test.js
new file mode 100644
index 000000000..20fcdf22c
--- /dev/null
+++ b/Sprint-2/interpret/invert.test.js
@@ -0,0 +1,10 @@
+const invert = require("../interpret/invert.js");
+
+test("test for a number followed by a letter", () => {
+ expect(invert({ 1: "a", 2: "b", 3: "c" })).toEqual({
+ a: "1",
+ b: "2",
+ c: "3",
+ });
+});
+// expect(tally([])).toEqual({});
diff --git a/Sprint-2/package-lock.json b/Sprint-2/package-lock.json
index 9b4c725d6..ceda7296e 100644
--- a/Sprint-2/package-lock.json
+++ b/Sprint-2/package-lock.json
@@ -56,6 +56,7 @@
"integrity": "sha512-Oixnb+DzmRT30qu9d3tJSQkxuygWm32DFykT4bRoORPa9hZ/L4KhVB/XiRm6KG+roIEM7DBQlmg27kw2HZkdZg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.25.7",
@@ -1368,6 +1369,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"caniuse-lite": "^1.0.30001663",
"electron-to-chromium": "^1.5.28",
diff --git a/Sprint-3/quote-generator need-review/QuoteGeneratorApp.html b/Sprint-3/quote-generator need-review/QuoteGeneratorApp.html
new file mode 100644
index 000000000..ecbd89002
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/QuoteGeneratorApp.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Title here
+
+
+
+
hello there
+
+
+
+
+
diff --git a/Sprint-3/quote-generator need-review/package.json b/Sprint-3/quote-generator need-review/package.json
new file mode 100644
index 000000000..0f6f98917
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "quote-generator",
+ "version": "1.0.0",
+ "license": "CC-BY-SA-4.0",
+ "description": "You must update this package",
+ "scripts": {
+ "test": "jest --config=../jest.config.js quote-generator"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/CodeYourFuture/CYF-Coursework-Template.git"
+ },
+ "bugs": {
+ "url": "https://github.com/CodeYourFuture/CYF-Coursework-Template/issues"
+ },
+ "homepage": "https://github.com/CodeYourFuture/CYF-Coursework-Template#readme"
+}
diff --git a/Sprint-3/quote-generator need-review/quote_generator_example.png b/Sprint-3/quote-generator need-review/quote_generator_example.png
new file mode 100644
index 000000000..0226264f0
Binary files /dev/null and b/Sprint-3/quote-generator need-review/quote_generator_example.png differ
diff --git a/Sprint-3/quote-generator need-review/quotes.js b/Sprint-3/quote-generator need-review/quotes.js
new file mode 100644
index 000000000..d6a3a7364
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/quotes.js
@@ -0,0 +1,509 @@
+const botton = document
+ .getElementById("new-quote")
+ .addEventListener("click", pickNewQuoteToDisplay);
+
+function pickNewQuoteToDisplay(quote) {
+ //gets the quote object and brakes it down to the key and value
+ let quoteAndAuther = pickFromArray(quotes);
+ let quoteForDisplay = quoteAndAuther.quote;
+ let authorForDisplay = quoteAndAuther.author;
+ // prints the values to the page
+ document.getElementById("quote").innerHTML = quoteForDisplay;
+ document.getElementById("author").innerHTML = authorForDisplay;
+}
+
+//function randomQuote()
+
+// DO NOT EDIT BELOW HERE
+
+// pickFromArray is a function which will return one item, at
+// random, from the given array.
+//
+// Parameters
+// ----------
+// choices: an array of items to pick from.
+//
+// Returns
+// -------
+// One item at random from the given array.
+//
+// Examples of use
+// ---------------
+// pickFromArray(['a','b','c','d']) // maybe returns 'c'
+
+// You don't need to change this function
+function pickFromArray(choices) {
+ return choices[Math.floor(Math.random() * choices.length)];
+}
+
+// A list of quotes you can use in your app.
+// DO NOT modify this array, otherwise the tests may break!
+const quotes = [
+ {
+ quote: "Life isn't about getting and having, it's about giving and being.",
+ author: "Kevin Kruse",
+ },
+ {
+ quote: "Whatever the mind of man can conceive and believe, it can achieve.",
+ author: "Napoleon Hill",
+ },
+ {
+ quote: "Strive not to be a success, but rather to be of value.",
+ author: "Albert Einstein",
+ },
+ {
+ quote:
+ "Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.",
+ author: "Robert Frost",
+ },
+ {
+ quote: "I attribute my success to this: I never gave or took any excuse.",
+ author: "Florence Nightingale",
+ },
+ {
+ quote: "You miss 100% of the shots you don't take.",
+ author: "Wayne Gretzky",
+ },
+ {
+ quote:
+ "I've missed more than 9000 shots in my career. I've lost almost 300 games. 26 times I've been trusted to take the game winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed.",
+ author: "Michael Jordan",
+ },
+ {
+ quote:
+ "The most difficult thing is the decision to act, the rest is merely tenacity.",
+ author: "Amelia Earhart",
+ },
+ {
+ quote: "Every strike brings me closer to the next home run.",
+ author: "Babe Ruth",
+ },
+ {
+ quote: "Definiteness of purpose is the starting point of all achievement.",
+ author: "W. Clement Stone",
+ },
+ {
+ quote: "We must balance conspicuous consumption with conscious capitalism.",
+ author: "Kevin Kruse",
+ },
+ {
+ quote: "Life is what happens to you while you're busy making other plans.",
+ author: "John Lennon",
+ },
+ {
+ quote: "We become what we think about.",
+ author: "Earl Nightingale",
+ },
+ {
+ quote:
+ "Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do, so throw off the bowlines, sail away from safe harbor, catch the trade winds in your sails. Explore, Dream, Discover.",
+ author: "Mark Twain",
+ },
+ {
+ quote: "Life is 10% what happens to me and 90% of how I react to it.",
+ author: "Charles Swindoll",
+ },
+ {
+ quote:
+ "The most common way people give up their power is by thinking they don't have any.",
+ author: "Alice Walker",
+ },
+ {
+ quote: "The mind is everything. What you think you become.",
+ author: "Buddha",
+ },
+ {
+ quote:
+ "The best time to plant a tree was 20 years ago. The second best time is now.",
+ author: "Chinese Proverb",
+ },
+ {
+ quote: "An unexamined life is not worth living.",
+ author: "Socrates",
+ },
+ {
+ quote: "Eighty percent of success is showing up.",
+ author: "Woody Allen",
+ },
+ {
+ quote:
+ "Your time is limited, so don't waste it living someone else's life.",
+ author: "Steve Jobs",
+ },
+ {
+ quote: "Winning isn't everything, but wanting to win is.",
+ author: "Vince Lombardi",
+ },
+ {
+ quote:
+ "I am not a product of my circumstances. I am a product of my decisions.",
+ author: "Stephen Covey",
+ },
+ {
+ quote:
+ "Every child is an artist. The problem is how to remain an artist once he grows up.",
+ author: "Pablo Picasso",
+ },
+ {
+ quote:
+ "You can never cross the ocean until you have the courage to lose sight of the shore.",
+ author: "Christopher Columbus",
+ },
+ {
+ quote:
+ "I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel.",
+ author: "Maya Angelou",
+ },
+ {
+ quote: "Either you run the day, or the day runs you.",
+ author: "Jim Rohn",
+ },
+ {
+ quote: "Whether you think you can or you think you can't, you're right.",
+ author: "Henry Ford",
+ },
+ {
+ quote:
+ "The two most important days in your life are the day you are born and the day you find out why.",
+ author: "Mark Twain",
+ },
+ {
+ quote:
+ "Whatever you can do, or dream you can, begin it. Boldness has genius, power and magic in it.",
+ author: "Johann Wolfgang von Goethe",
+ },
+ {
+ quote: "The best revenge is massive success.",
+ author: "Frank Sinatra",
+ },
+ {
+ quote:
+ "People often say that motivation doesn't last. Well, neither does bathing. That's why we recommend it daily.",
+ author: "Zig Ziglar",
+ },
+ {
+ quote: "Life shrinks or expands in proportion to one's courage.",
+ author: "Anais Nin",
+ },
+ {
+ quote:
+ "If you hear a voice within you say “you cannot paint,” then by all means paint and that voice will be silenced.",
+ author: "Vincent Van Gogh",
+ },
+ {
+ quote:
+ "There is only one way to avoid criticism: do nothing, say nothing, and be nothing.",
+ author: "Aristotle",
+ },
+ {
+ quote:
+ "Ask and it will be given to you; search, and you will find; knock and the door will be opened for you.",
+ author: "Jesus",
+ },
+ {
+ quote:
+ "The only person you are destined to become is the person you decide to be.",
+ author: "Ralph Waldo Emerson",
+ },
+ {
+ quote:
+ "Go confidently in the direction of your dreams. Live the life you have imagined.",
+ author: "Henry David Thoreau",
+ },
+ {
+ quote:
+ "When I stand before God at the end of my life, I would hope that I would not have a single bit of talent left and could say, I used everything you gave me.",
+ author: "Erma Bombeck",
+ },
+ {
+ quote:
+ "Few things can help an individual more than to place responsibility on him, and to let him know that you trust him.",
+ author: "Booker T. Washington",
+ },
+ {
+ quote:
+ "Certain things catch your eye, but pursue only those that capture the heart.",
+ author: " Ancient Indian Proverb",
+ },
+ {
+ quote: "Believe you can and you're halfway there.",
+ author: "Theodore Roosevelt",
+ },
+ {
+ quote: "Everything you've ever wanted is on the other side of fear.",
+ author: "George Addair",
+ },
+ {
+ quote:
+ "We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light.",
+ author: "Plato",
+ },
+ {
+ quote:
+ "Teach thy tongue to say, “I do not know,” and thous shalt progress.",
+ author: "Maimonides",
+ },
+ {
+ quote: "Start where you are. Use what you have. Do what you can.",
+ author: "Arthur Ashe",
+ },
+ {
+ quote:
+ "When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down ‘happy'. They told me I didn't understand the assignment, and I told them they didn't understand life.",
+ author: "John Lennon",
+ },
+ {
+ quote: "Fall seven times and stand up eight.",
+ author: "Japanese Proverb",
+ },
+ {
+ quote:
+ "When one door of happiness closes, another opens, but often we look so long at the closed door that we do not see the one that has been opened for us.",
+ author: "Helen Keller",
+ },
+ {
+ quote: "Everything has beauty, but not everyone can see.",
+ author: "Confucius",
+ },
+ {
+ quote:
+ "How wonderful it is that nobody need wait a single moment before starting to improve the world.",
+ author: "Anne Frank",
+ },
+ {
+ quote: "When I let go of what I am, I become what I might be.",
+ author: "Lao Tzu",
+ },
+ {
+ quote:
+ "Life is not measured by the number of breaths we take, but by the moments that take our breath away.",
+ author: "Maya Angelou",
+ },
+ {
+ quote:
+ "Happiness is not something readymade. It comes from your own actions.",
+ author: "Dalai Lama",
+ },
+ {
+ quote:
+ "If you're offered a seat on a rocket ship, don't ask what seat! Just get on.",
+ author: "Sheryl Sandberg",
+ },
+ {
+ quote:
+ "First, have a definite, clear practical ideal; a goal, an objective. Second, have the necessary means to achieve your ends; wisdom, money, materials, and methods. Third, adjust all your means to that end.",
+ author: "Aristotle",
+ },
+ {
+ quote: "If the wind will not serve, take to the oars.",
+ author: "Latin Proverb",
+ },
+ {
+ quote:
+ "You can't fall if you don't climb. But there's no joy in living your whole life on the ground.",
+ author: "Unknown",
+ },
+ {
+ quote:
+ "We must believe that we are gifted for something, and that this thing, at whatever cost, must be attained.",
+ author: "Marie Curie",
+ },
+ {
+ quote:
+ "Too many of us are not living our dreams because we are living our fears.",
+ author: "Les Brown",
+ },
+ {
+ quote:
+ "Challenges are what make life interesting and overcoming them is what makes life meaningful.",
+ author: "Joshua J. Marine",
+ },
+ {
+ quote: "If you want to lift yourself up, lift up someone else.",
+ author: "Booker T. Washington",
+ },
+ {
+ quote:
+ "I have been impressed with the urgency of doing. Knowing is not enough; we must apply. Being willing is not enough; we must do.",
+ author: "Leonardo da Vinci",
+ },
+ {
+ quote:
+ "Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.",
+ author: "Jamie Paolinetti",
+ },
+ {
+ quote:
+ "You take your life in your own hands, and what happens? A terrible thing, no one to blame.",
+ author: "Erica Jong",
+ },
+ {
+ quote:
+ "What's money? A man is a success if he gets up in the morning and goes to bed at night and in between does what he wants to do.",
+ author: "Bob Dylan",
+ },
+ {
+ quote: "I didn't fail the test. I just found 100 ways to do it wrong.",
+ author: "Benjamin Franklin",
+ },
+ {
+ quote:
+ "In order to succeed, your desire for success should be greater than your fear of failure.",
+ author: "Bill Cosby",
+ },
+ {
+ quote: "A person who never made a mistake never tried anything new.",
+ author: " Albert Einstein",
+ },
+ {
+ quote:
+ "The person who says it cannot be done should not interrupt the person who is doing it.",
+ author: "Chinese Proverb",
+ },
+ {
+ quote: "There are no traffic jams along the extra mile.",
+ author: "Roger Staubach",
+ },
+ {
+ quote: "It is never too late to be what you might have been.",
+ author: "George Eliot",
+ },
+ {
+ quote: "You become what you believe.",
+ author: "Oprah Winfrey",
+ },
+ {
+ quote: "I would rather die of passion than of boredom.",
+ author: "Vincent van Gogh",
+ },
+ {
+ quote:
+ "A truly rich man is one whose children run into his arms when his hands are empty.",
+ author: "Unknown",
+ },
+ {
+ quote:
+ "It is not what you do for your children, but what you have taught them to do for themselves, that will make them successful human beings.",
+ author: "Ann Landers",
+ },
+ {
+ quote:
+ "If you want your children to turn out well, spend twice as much time with them, and half as much money.",
+ author: "Abigail Van Buren",
+ },
+ {
+ quote:
+ "Build your own dreams, or someone else will hire you to build theirs.",
+ author: "Farrah Gray",
+ },
+ {
+ quote:
+ "The battles that count aren't the ones for gold medals. The struggles within yourself-the invisible battles inside all of us-that's where it's at.",
+ author: "Jesse Owens",
+ },
+ {
+ quote: "Education costs money. But then so does ignorance.",
+ author: "Sir Claus Moser",
+ },
+ {
+ quote:
+ "I have learned over the years that when one's mind is made up, this diminishes fear.",
+ author: "Rosa Parks",
+ },
+ {
+ quote: "It does not matter how slowly you go as long as you do not stop.",
+ author: "Confucius",
+ },
+ {
+ quote:
+ "If you look at what you have in life, you'll always have more. If you look at what you don't have in life, you'll never have enough.",
+ author: "Oprah Winfrey",
+ },
+ {
+ quote:
+ "Remember that not getting what you want is sometimes a wonderful stroke of luck.",
+ author: "Dalai Lama",
+ },
+ {
+ quote: "You can't use up creativity. The more you use, the more you have.",
+ author: "Maya Angelou",
+ },
+ {
+ quote: "Dream big and dare to fail.",
+ author: "Norman Vaughan",
+ },
+ {
+ quote:
+ "Our lives begin to end the day we become silent about things that matter.",
+ author: "Martin Luther King Jr.",
+ },
+ {
+ quote: "Do what you can, where you are, with what you have.",
+ author: "Teddy Roosevelt",
+ },
+ {
+ quote:
+ "If you do what you've always done, you'll get what you've always gotten.",
+ author: "Tony Robbins",
+ },
+ {
+ quote: "Dreaming, after all, is a form of planning.",
+ author: "Gloria Steinem",
+ },
+ {
+ quote:
+ "It's your place in the world; it's your life. Go on and do all you can with it, and make it the life you want to live.",
+ author: "Mae Jemison",
+ },
+ {
+ quote:
+ "You may be disappointed if you fail, but you are doomed if you don't try.",
+ author: "Beverly Sills",
+ },
+ {
+ quote: "Remember no one can make you feel inferior without your consent.",
+ author: "Eleanor Roosevelt",
+ },
+ {
+ quote: "Life is what we make it, always has been, always will be.",
+ author: "Grandma Moses",
+ },
+ {
+ quote:
+ "The question isn't who is going to let me; it's who is going to stop me.",
+ author: "Ayn Rand",
+ },
+ {
+ quote:
+ "When everything seems to be going against you, remember that the airplane takes off against the wind, not with it.",
+ author: "Henry Ford",
+ },
+ {
+ quote:
+ "It's not the years in your life that count. It's the life in your years.",
+ author: "Abraham Lincoln",
+ },
+ {
+ quote: "Change your thoughts and you change your world.",
+ author: "Norman Vincent Peale",
+ },
+ {
+ quote:
+ "Either write something worth reading or do something worth writing.",
+ author: "Benjamin Franklin",
+ },
+ {
+ quote: "Nothing is impossible, the word itself says, “I'm possible!”",
+ author: "-Audrey Hepburn",
+ },
+ {
+ quote: "The only way to do great work is to love what you do.",
+ author: "Steve Jobs",
+ },
+ {
+ quote: "If you can dream it, you can achieve it.",
+ author: "Zig Ziglar",
+ },
+];
+
+console.log(pickFromArray(quotes));
diff --git a/Sprint-3/quote-generator need-review/quotes.test.js b/Sprint-3/quote-generator need-review/quotes.test.js
new file mode 100644
index 000000000..f7b128bf7
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/quotes.test.js
@@ -0,0 +1,77 @@
+/* ======= TESTS - DO NOT MODIFY =====
+There are some Tests in this file that will help you work out if your code is working.
+*/
+
+const path = require("path");
+const { JSDOM } = require("jsdom");
+
+let page = null;
+
+beforeEach(async () => {
+ page = await JSDOM.fromFile(path.join(__dirname, "index.html"), {
+ resources: "usable",
+ runScripts: "dangerously",
+ });
+
+ // do this so students can use element.innerText which jsdom does not implement
+ Object.defineProperty(page.window.HTMLElement.prototype, "innerText", {
+ get() {
+ return this.textContent;
+ },
+ set(value) {
+ this.textContent = value;
+ },
+ });
+
+ jest
+ .spyOn(page.window.Math, "random")
+ .mockReturnValueOnce(0.02) // random number to target Albert Einstein quote [index: 2]
+ .mockReturnValueOnce(0.25) // random number to target Maya Angelou quote [index: 25]
+ .mockReturnValueOnce(0.79); // random number to target Rosa Parks quote [index: 80]
+
+ return new Promise((res) => {
+ page.window.document.addEventListener("load", res);
+ });
+});
+
+afterEach(() => {
+ page = null;
+ jest.restoreAllMocks();
+});
+
+describe("Quote generator", () => {
+ test("initially displays quote and author", () => {
+ const quoteP = page.window.document.querySelector("#quote");
+ const authorP = page.window.document.querySelector("#author");
+
+ expect(quoteP).toHaveTextContent(
+ "Strive not to be a success, but rather to be of value."
+ );
+ expect(authorP).toHaveTextContent("Albert Einstein");
+ });
+ test("can change quote to another random quote", () => {
+ const quoteP = page.window.document.querySelector("#quote");
+ const authorP = page.window.document.querySelector("#author");
+ const newQuoteBtn = page.window.document.querySelector("#new-quote");
+
+ expect(quoteP).toHaveTextContent(
+ "Strive not to be a success, but rather to be of value."
+ );
+ expect(authorP).toHaveTextContent("Albert Einstein");
+ expect(newQuoteBtn).toHaveTextContent("New quote");
+
+ newQuoteBtn.click();
+
+ expect(quoteP).toHaveTextContent(
+ "I've learned that people will forget what you said, people will forget what you did, but people will never forget how you made them feel."
+ );
+ expect(authorP).toHaveTextContent("Maya Angelou");
+
+ newQuoteBtn.click();
+
+ expect(quoteP).toHaveTextContent(
+ "I have learned over the years that when one's mind is made up, this diminishes fear."
+ );
+ expect(authorP).toHaveTextContent("Rosa Parks");
+ });
+});
diff --git a/Sprint-3/quote-generator need-review/readme.md b/Sprint-3/quote-generator need-review/readme.md
new file mode 100644
index 000000000..868291958
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/readme.md
@@ -0,0 +1,43 @@
+# Make a Quote Generator
+
+In this folder you will find the basic setup of a quote generator.
+
+You can change any of the files in this project.
+
+First off, once you've branched off `main`, then update the title element in `index.html` to "Quote generator app"
+
+## How the Quote Generator should work
+
+When the page loads it should show a random quote from the `quotes` array on the screen. It should also show who said the quote.
+
+When you click a button on the screen it should change the quote on the screen.
+
+It can look however you like but there is an example in this folder at `quote_generator_example.png`
+
+## Need Help?
+
+- If you can't work out how to find a random element from the array, either:
+ - (advanced) try to use `Math.random()`
+ - OR
+ - (basic) use the `pickFromArray()` function supplied in the javascript file.
+
+## Stretch
+
+Only attempt the stretch once you've attempted the other sections.
+
+### Add auto-play to your quote generator
+
+For this task you will return to your quote generator and improve it with "auto-generate" functionality:
+
+- Add a toggle-switch or checkbox input to your existing quote generator.
+- When the switch is ON:
+ - ... the generator should pick and display a new quote every 60 seconds. (When testing you will probably want to reduce this to every 5 seconds.)
+ - ... the generator should display "auto-play:ON" somewhere on the page.
+- When the switch is OFF
+ - ... the generator should NOT change quote automatically
+
+## Hints:
+
+Use https://rot13.com/ to decipher this hint:
+
+`Pubbfr bar bs frgGvzrbhg be frgVagreiny.`
diff --git a/Sprint-3/quote-generator need-review/style.css b/Sprint-3/quote-generator need-review/style.css
new file mode 100644
index 000000000..63cedf2d2
--- /dev/null
+++ b/Sprint-3/quote-generator need-review/style.css
@@ -0,0 +1 @@
+/** Write your CSS in here **/
diff --git a/Sprint-3/reading-list/Reading list app.html b/Sprint-3/reading-list/Reading list app.html
new file mode 100644
index 000000000..62a835933
--- /dev/null
+++ b/Sprint-3/reading-list/Reading list app.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ Title here
+
+
+
+