diff --git a/1-exercises/A-undefined/exercise.js b/1-exercises/A-undefined/exercise.js index 0acfc78d..5a1b90eb 100644 --- a/1-exercises/A-undefined/exercise.js +++ b/1-exercises/A-undefined/exercise.js @@ -12,25 +12,32 @@ // Example 1 let a; console.log(a); - +// a has been declared by no value has been assigned. // Example 2 function sayHello() { - let message = "Hello"; + let message = "Hello"; } let hello = sayHello(); console.log(hello); - +// function sayHello has been declared by no value returned from the function +// hello has been assigned the function sayHello which does not return anything +// There is nothing for console.log to output so response is undefined. // Example 3 function sayHelloToUser(user) { - console.log(`Hello ${user}`); + console.log(`Hello ${user}`); } sayHelloToUser(); - +// function sayHelloToUser is being called without an argument +// sayHelloToUser expects an argument so will output undefined in the logged response +// for variable 'user' after outputting 'Hello ' // Example 4 -let arr = [1,2,3]; +let arr = [1, 2, 3]; console.log(arr[3]); + +// there are only 3 entries ranging from [0] to [2] in the array 'arr' +// arr [3] doesn't have a value (because it's the 4th array element) so will show undefined. diff --git a/1-exercises/B-array-literals/exercise.js b/1-exercises/B-array-literals/exercise.js index 51eba5cc..c0d61235 100644 --- a/1-exercises/B-array-literals/exercise.js +++ b/1-exercises/B-array-literals/exercise.js @@ -5,8 +5,12 @@ */ let numbers = []; // add numbers from 1 to 10 into this array -let mentors; // Create an array with the names of the mentors: Daniel, Irina and Rares - +for (let i = 0; i < 10; i++) { + numbers.push(i); +} +let mentors = []; // Create an array with the names of the mentors: Daniel, Irina and Rares +let names = ["Daniel", "Irina", "Rares"]; +mentors.push(...names); /* DO NOT EDIT BELOW THIS LINE --------------------------- */ diff --git a/1-exercises/C-array-get-set/exercise.js b/1-exercises/C-array-get-set/exercise.js index 5ca911d5..9c1d01d7 100644 --- a/1-exercises/C-array-get-set/exercise.js +++ b/1-exercises/C-array-get-set/exercise.js @@ -5,11 +5,11 @@ */ function first(arr) { - return; // complete this statement + return arr[0]; // complete this statement } function last(arr) { - return; // complete this statement + return arr[arr.length - 1]; // complete this statement } /* diff --git a/1-exercises/C-array-get-set/exercises2.js b/1-exercises/C-array-get-set/exercises2.js index 6b6b007a..39d0bf74 100644 --- a/1-exercises/C-array-get-set/exercises2.js +++ b/1-exercises/C-array-get-set/exercises2.js @@ -7,6 +7,8 @@ */ let numbers = [1, 2, 3]; // Don't change this array literal declaration +numbers.push(4); +numbers[0] = 2; /* DO NOT EDIT BELOW THIS LINE diff --git a/1-exercises/D-for-loop/exercise.js b/1-exercises/D-for-loop/exercise.js index 081002b2..cf702908 100644 --- a/1-exercises/D-for-loop/exercise.js +++ b/1-exercises/D-for-loop/exercise.js @@ -11,22 +11,19 @@ */ const WRITERS = [ - "Virginia Woolf", - "Zadie Smith", - "Jane Austen", - "Bell Hooks", - "Yukiko Motoya" -] - -const AGES = [ - 59, - 40, - 41, - 63, - 49 + "Virginia Woolf", + "Zadie Smith", + "Jane Austen", + "Bell Hooks", + "Yukiko Motoya", ]; +const AGES = [59, 40, 41, 63, 49]; + // TODO - Write for loop code here +for (let i = 0; i < WRITERS.length; i++) { + console.log(`${WRITERS[i]} is ${AGES[i]} years old`); +} /* The output should look something like this: diff --git a/1-exercises/E-while-loop-with-array/exercise.js b/1-exercises/E-while-loop-with-array/exercise.js index d584cd75..b74d92d2 100644 --- a/1-exercises/E-while-loop-with-array/exercise.js +++ b/1-exercises/E-while-loop-with-array/exercise.js @@ -5,19 +5,30 @@ */ const BIRTHDAYS = [ - "January 7th", - "February 12th", - "April 3rd", - "April 5th", - "May 3rd", - "July 11th", - "July 17th", - "September 28th", - "November 15th" + "January 7th", + "February 12th", + "April 3rd", + "April 5th", + "May 3rd", + "July 11th", + "July 17th", + "September 28th", + "November 15th", ]; function findFirstJulyBDay(birthdays) { - // TODO + // TODO + // for (let i = 0; i < BIRTHDAYS.length; i++) { + // if (BIRTHDAYS[i].includes("July")) { + // return BIRTHDAYS[i]; + // } + // } + + for (let birthday of BIRTHDAYS) { + if (birthday.includes("July")) { + return birthday; + } + } } console.log(findFirstJulyBDay(BIRTHDAYS)); // should output "July 11th" diff --git a/2-mandatory/1-weather-report.js b/2-mandatory/1-weather-report.js index dcc2bdb0..f7a0e1b3 100644 --- a/2-mandatory/1-weather-report.js +++ b/2-mandatory/1-weather-report.js @@ -2,7 +2,7 @@ Imagine we're making a weather app! We have a list of cities that the user wants to track. - We also already have a temperatureService function which will take a city as a parameter and return a temparature. + We also already have a temperatureService function which will take a city as a parameter and return a temperature. Implement the function below: - take the array of cities as a parameter @@ -12,52 +12,50 @@ */ function getTemperatureReport(cities) { - // TODO + const weatherInCities = []; + for (const city of cities) { + let cityTemperature = temperatureService(city); + let cityStatement = `The temperature in ${city} is ${cityTemperature} degrees`; + weatherInCities.push(cityStatement); + } + return weatherInCities; } - /* ======= TESTS - DO NOT MODIFY ===== */ function temperatureService(city) { - let temparatureMap = new Map(); - - temparatureMap.set('London', 10); - temparatureMap.set('Paris', 12); - temparatureMap.set('Barcelona', 17); - temparatureMap.set('Dubai', 27); - temparatureMap.set('Mumbai', 29); - temparatureMap.set('São Paulo', 23); - temparatureMap.set('Lagos', 33); - - return temparatureMap.get(city); + let temparatureMap = new Map(); + + temparatureMap.set("London", 10); + temparatureMap.set("Paris", 12); + temparatureMap.set("Barcelona", 17); + temparatureMap.set("Dubai", 27); + temparatureMap.set("Mumbai", 29); + temparatureMap.set("São Paulo", 23); + temparatureMap.set("Lagos", 33); + + return temparatureMap.get(city); } test("should return a temperature report for the user's cities", () => { - let usersCities = [ - "London", - "Paris", - "São Paulo" - ] - - expect(getTemperatureReport(usersCities)).toEqual([ - "The temperature in London is 10 degrees", - "The temperature in Paris is 12 degrees", - "The temperature in São Paulo is 23 degrees" - ]); + let usersCities = ["London", "Paris", "São Paulo"]; + + expect(getTemperatureReport(usersCities)).toEqual([ + "The temperature in London is 10 degrees", + "The temperature in Paris is 12 degrees", + "The temperature in São Paulo is 23 degrees", + ]); }); test("should return a temperature report for the user's cities (alternate input)", () => { - let usersCities = [ - "Barcelona", - "Dubai" - ] - - expect(getTemperatureReport(usersCities)).toEqual([ - "The temperature in Barcelona is 17 degrees", - "The temperature in Dubai is 27 degrees" - ]); + let usersCities = ["Barcelona", "Dubai"]; + + expect(getTemperatureReport(usersCities)).toEqual([ + "The temperature in Barcelona is 17 degrees", + "The temperature in Dubai is 27 degrees", + ]); }); test("should return an empty array if the user hasn't selected any cities", () => { - expect(getTemperatureReport([])).toEqual([]); -}); \ No newline at end of file + expect(getTemperatureReport([])).toEqual([]); +}); diff --git a/2-mandatory/2-financial-times.js b/2-mandatory/2-financial-times.js index 2ce6fb73..fa7c5ef1 100644 --- a/2-mandatory/2-financial-times.js +++ b/2-mandatory/2-financial-times.js @@ -5,16 +5,39 @@ Implement the function below, which will return a new array containing only article titles which will fit. */ function potentialHeadlines(allArticleTitles) { - // TODO + const charLimit = 65; + const articlesUnderLimit = []; + + for (const articleTitle of allArticleTitles) { + if (articleTitle.length <= charLimit) { + articlesUnderLimit.push(articleTitle); + } + } + return articlesUnderLimit; } /* The editor of the FT likes short headlines with only a few words! Implement the function below, which returns the title with the fewest words. - (you can assume words will always be seperated by a space) + (you can assume words will always be separated by a space) */ function titleWithFewestWords(allArticleTitles) { - // TODO + // TODO + let shortestTitle = ""; + let shortestSpaceCount = 0; + for (const title of allArticleTitles) { + if (shortestTitle === "") { + shortestTitle = title; + shortestSpaceCount = title.split(" ").length - 1; + } else { + let currentSpaceCount = title.split(" ").length - 1; + if (currentSpaceCount < shortestSpaceCount) { + shortestTitle = title; + shortestSpaceCount = currentSpaceCount; + } + } + } + return shortestTitle; } /* @@ -22,8 +45,19 @@ function titleWithFewestWords(allArticleTitles) { Implement the function below to return a new array containing all the headlines which contain a number. (Hint: remember that you can also loop through the characters of a string if you need to) */ + +function containsNumbers(str) { + return /[0-9]/.test(str); +} + function headlinesWithNumbers(allArticleTitles) { - // TODO + let numberArticles = []; + for (const title of allArticleTitles) { + if (containsNumbers(title)) { + numberArticles.push(title); + } + } + return numberArticles; } /* @@ -31,51 +65,62 @@ function headlinesWithNumbers(allArticleTitles) { Implement the function below to return this number - rounded to the nearest integer. */ function averageNumberOfCharacters(allArticleTitles) { - // TODO + // TODO + let charCount = 0; + const articleTitleCount = allArticleTitles.length; + for (const articleTitle of allArticleTitles) { + charCount += articleTitle.length; + } + const averageCharCount = Math.round(charCount / articleTitleCount); + return averageCharCount; } - - /* ======= List of Articles - DO NOT MODIFY ===== */ const ARTICLE_TITLES = [ - "Streaming wars drive media groups to spend more than $100bn on new content", - "Amazon Prime Video India country head: streaming is driving a TV revolution", - "Aerospace chiefs prepare for bumpy ride in recovery of long-haul flights", - "British companies look to muscle in on US retail investing boom", - "Libor to take firm step towards oblivion on New Year's Day", - "Audit profession unattractive to new recruits, says PwC boss", - "Chinese social media users blast Elon Musk over near miss in space", - "Companies raise over $12tn in 'blockbuster' year for global capital markets", - "The three questions that dominate investment", - "Brussels urges Chile's incoming president to endorse EU trade deal", + "Streaming wars drive media groups to spend more than $100bn on new content", + "Amazon Prime Video India country head: streaming is driving a TV revolution", + "Aerospace chiefs prepare for bumpy ride in recovery of long-haul flights", + "British companies look to muscle in on US retail investing boom", + "Libor to take firm step towards oblivion on New Year's Day", + "Audit profession unattractive to new recruits, says PwC boss", + "Chinese social media users blast Elon Musk over near miss in space", + "Companies raise over $12tn in 'blockbuster' year for global capital markets", + "The three questions that dominate investment", + "Brussels urges Chile's incoming president to endorse EU trade deal", ]; /* ======= TESTS - DO NOT MODIFY ===== */ test("should only return potential headlines", () => { - expect(new Set(potentialHeadlines(ARTICLE_TITLES))).toEqual(new Set([ - "British companies look to muscle in on US retail investing boom", - "Libor to take firm step towards oblivion on New Year's Day", - "Audit profession unattractive to new recruits, says PwC boss", - "The three questions that dominate investment" - ])); + expect(new Set(potentialHeadlines(ARTICLE_TITLES))).toEqual( + new Set([ + "British companies look to muscle in on US retail investing boom", + "Libor to take firm step towards oblivion on New Year's Day", + "Audit profession unattractive to new recruits, says PwC boss", + "The three questions that dominate investment", + ]) + ); }); test("should return an empty array for empty input", () => { - expect(potentialHeadlines([])).toEqual([]); + expect(potentialHeadlines([])).toEqual([]); }); test("should return the title with the fewest words", () => { - expect(titleWithFewestWords(ARTICLE_TITLES)).toEqual("The three questions that dominate investment"); + expect(titleWithFewestWords(ARTICLE_TITLES)).toEqual( + "The three questions that dominate investment" + ); }); test("should only return headlines containing numbers", () => { - expect(new Set(headlinesWithNumbers(ARTICLE_TITLES))).toEqual(new Set([ - "Streaming wars drive media groups to spend more than $100bn on new content", - "Companies raise over $12tn in 'blockbuster' year for global capital markets" - ])); + expect(new Set(headlinesWithNumbers(ARTICLE_TITLES))).toEqual( + new Set([ + "Streaming wars drive media groups to spend more than $100bn on new content", + "Companies raise over $12tn in 'blockbuster' year for global capital markets", + ]) + ); }); test("should return the average number of characters in a headline", () => { - expect(averageNumberOfCharacters(ARTICLE_TITLES)).toEqual(65); + expect(averageNumberOfCharacters(ARTICLE_TITLES)).toEqual(65); }); diff --git a/2-mandatory/3-stocks.js b/2-mandatory/3-stocks.js index 72d62f94..64821442 100644 --- a/2-mandatory/3-stocks.js +++ b/2-mandatory/3-stocks.js @@ -11,11 +11,11 @@ const STOCKS = ["aapl", "msft", "amzn", "googl", "tsla"]; const CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS = [ - [179.19, 180.33, 176.28, 175.64, 172.99], // AAPL - [340.69, 342.45, 334.69, 333.20, 327.29], // MSFT - [3384.44, 3393.39, 3421.37, 3420.74, 3408.34], // AMZN - [2951.88, 2958.13, 2938.33, 2928.30, 2869.45], // GOOGL - [1101.30, 1093.94, 1067.00, 1008.87, 938.53] // TSLA + [179.19, 180.33, 176.28, 175.64, 172.99], // AAPL + [340.69, 342.45, 334.69, 333.2, 327.29], // MSFT + [3384.44, 3393.39, 3421.37, 3420.74, 3408.34], // AMZN + [2951.88, 2958.13, 2938.33, 2928.3, 2869.45], // GOOGL + [1101.3, 1093.94, 1067.0, 1008.87, 938.53], // TSLA ]; /* @@ -34,7 +34,18 @@ const CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS = [ Functions can help with this! */ function getAveragePrices(closingPricesForAllStocks) { - // TODO + let stockAveragePrices = []; + for (const companyPrices of closingPricesForAllStocks) { + const daysCount = companyPrices.length; + let companyPriceTotal = 0; + for (const singlePrice of companyPrices) { + companyPriceTotal += singlePrice; + } + const averageStockPrice = + Math.round((companyPriceTotal / daysCount) * 100) / 100; + stockAveragePrices.push(averageStockPrice); + } + return stockAveragePrices; } /* @@ -48,7 +59,17 @@ function getAveragePrices(closingPricesForAllStocks) { The price change value should be rounded to 2 decimal places, and should be a number (not a string) */ function getPriceChanges(closingPricesForAllStocks) { - // TODO + // TODO + const stockPriceDifferences = []; + for (const companyPrices of closingPricesForAllStocks) { + const firstPricePosition = 0; + const lastPricePosition = companyPrices.length - 1; + const stockPriceDiff = + companyPrices[lastPricePosition] - companyPrices[firstPricePosition]; + const stockPriceDiffRounded = Math.round(stockPriceDiff * 100) / 100; + stockPriceDifferences.push(stockPriceDiffRounded); + } + return stockPriceDifferences; } /* @@ -64,31 +85,48 @@ function getPriceChanges(closingPricesForAllStocks) { The price should be shown with exactly 2 decimal places. */ function highestPriceDescriptions(closingPricesForAllStocks, stocks) { - // TODO + // TODO + const highestStockPrices = []; + let stockCounter = 0; + for (const companyPrices of closingPricesForAllStocks) { + let highestPrice = 0; + for (const singlePrice of companyPrices) { + if (singlePrice > highestPrice) { + highestPrice = singlePrice; + } + } + let highestPriceRounded = Math.round(highestPrice * 100) / 100; + let stockUpperCase = stocks[stockCounter].toUpperCase(); + stockCounter++; + let highestPriceEntry = `The highest price of ${stockUpperCase} in the last 5 days was ${highestPriceRounded.toFixed( + 2 + )}`; + highestStockPrices.push(highestPriceEntry); + } + return highestStockPrices; } - /* ======= TESTS - DO NOT MODIFY ===== */ test("should return the average price for each stock", () => { - expect(getAveragePrices(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS)).toEqual( - [176.89, 335.66, 3405.66, 2929.22, 1041.93] - ); + expect(getAveragePrices(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS)).toEqual([ + 176.89, 335.66, 3405.66, 2929.22, 1041.93, + ]); }); test("should return the price change for each stock", () => { - expect(getPriceChanges(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS)).toEqual( - [-6.2, -13.4, 23.9, -82.43, -162.77] - ); + expect(getPriceChanges(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS)).toEqual([ + -6.2, -13.4, 23.9, -82.43, -162.77, + ]); }); test("should return a description of the highest price for each stock", () => { - expect(highestPriceDescriptions(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS, STOCKS)).toEqual( - [ - "The highest price of AAPL in the last 5 days was 180.33", - "The highest price of MSFT in the last 5 days was 342.45", - "The highest price of AMZN in the last 5 days was 3421.37", - "The highest price of GOOGL in the last 5 days was 2958.13", - "The highest price of TSLA in the last 5 days was 1101.30" - ] - ); + expect( + highestPriceDescriptions(CLOSING_PRICES_LAST_5_DAYS_FOR_ALL_STOCKS, STOCKS) + ).toEqual([ + "The highest price of AAPL in the last 5 days was 180.33", + "The highest price of MSFT in the last 5 days was 342.45", + "The highest price of AMZN in the last 5 days was 3421.37", + "The highest price of GOOGL in the last 5 days was 2958.13", + "The highest price of TSLA in the last 5 days was 1101.30", + ]); }); diff --git a/3-extra/1-radio-stations.js b/3-extra/1-radio-stations.js index 577076e9..4b9e4f18 100644 --- a/3-extra/1-radio-stations.js +++ b/3-extra/1-radio-stations.js @@ -14,7 +14,13 @@ */ // `getAllFrequencies` goes here - +function getAllFrequencies() { + let frequencies = []; + for (let i = 87; i <= 108; i++) { + frequencies.push(i); + } + return frequencies; +} /** * Next, let's write a function that gives us only the frequencies that are radio stations. * Call this function `getStations`. @@ -25,7 +31,16 @@ * - Return only the frequencies that are radio stations. */ // `getStations` goes here - +function getStations() { + const allFrequencies = getAllFrequencies(); + const onlyRadioFrequencies = []; + for (const frequency of allFrequencies) { + if (isRadioStation(frequency)) { + onlyRadioFrequencies.push(frequency); + } + } + return onlyRadioFrequencies; +} /* * ======= TESTS - DO NOT MODIFY ======= * Note: You are not expected to understand everything below this comment! diff --git a/3-extra/2-array-of-objects.js b/3-extra/2-array-of-objects.js index ee57960f..ef49a93b 100644 --- a/3-extra/2-array-of-objects.js +++ b/3-extra/2-array-of-objects.js @@ -9,74 +9,104 @@ Implement a function which takes the array of books as a parameter, and returns an array of book titles. Each title in the resulting array should be the highest rated book in its genre. */ +let highestBooks = []; +let highBook = {}; +let finalList = []; -function getHighestRatedInEachGenre(books) { - // TODO +function checkGenreListing(genreToCheck) { + for (let i = 0; i < highestBooks.length; i++) { + if (highestBooks[i].genre === genreToCheck) { + return i; + } + } + return -1; } +function getHighestRatedInEachGenre(books) { + for (let i = 0; i < books.length; i++) { + let positioning = checkGenreListing(books[i].genre); + if (positioning >= 0) { + if (books[i].rating > highestBooks[positioning].rating) { + highestBooks[positioning].title = books[i].title; + highestBooks[positioning].rating = books[i].rating; + } + } else { + highBook.title = books[i].title; + highBook.genre = books[i].genre; + highBook.rating = books[i].rating; + + highestBooks.push(highBook); + highBook = {}; + } + } + for (let i = 0; i < highestBooks.length; i++) { + finalList.push(highestBooks[i].title); + } + return finalList; +} /* ======= Book data - DO NOT MODIFY ===== */ const BOOKS = [ - { - title: "The Lion, the Witch and the Wardrobe", - genre: "children", - rating: 4.7 - }, - { - title: "Sapiens: A Brief History of Humankind", - genre: "non-fiction", - rating: 4.7 - }, - { - title: "Nadiya's Fast Flavours", - genre: "cooking", - rating: 4.7 - }, - { - title: "Harry Potter and the Philosopher's Stone", - genre: "children", - rating: 4.8 - }, - { - title: "A Life on Our Planet", - genre: "non-fiction", - rating: 4.8 - }, - { - title: "Dishoom: The first ever cookbook from the much-loved Indian restaurant", - genre: "cooking", - rating: 4.85 - }, - { - title: "Gangsta Granny Strikes Again!", - genre: "children", - rating: 4.9 - }, - { - title: "Diary of a Wimpy Kid", - genre: "children", - rating: 4.6 - }, - { - title: "BOSH!: Simple recipes. Unbelievable results. All plants.", - genre: "cooking", - rating: 4.6 - }, - { - title: "The Book Your Dog Wishes You Would Read", - genre: "non-fiction", - rating: 4.85 - }, -] - + { + title: "The Lion, the Witch and the Wardrobe", + genre: "children", + rating: 4.7, + }, + { + title: "Sapiens: A Brief History of Humankind", + genre: "non-fiction", + rating: 4.7, + }, + { + title: "Nadiya's Fast Flavours", + genre: "cooking", + rating: 4.7, + }, + { + title: "Harry Potter and the Philosopher's Stone", + genre: "children", + rating: 4.8, + }, + { + title: "A Life on Our Planet", + genre: "non-fiction", + rating: 4.8, + }, + { + title: + "Dishoom: The first ever cookbook from the much-loved Indian restaurant", + genre: "cooking", + rating: 4.85, + }, + { + title: "Gangsta Granny Strikes Again!", + genre: "children", + rating: 4.9, + }, + { + title: "Diary of a Wimpy Kid", + genre: "children", + rating: 4.6, + }, + { + title: "BOSH!: Simple recipes. Unbelievable results. All plants.", + genre: "cooking", + rating: 4.6, + }, + { + title: "The Book Your Dog Wishes You Would Read", + genre: "non-fiction", + rating: 4.85, + }, +]; /* ======= TESTS - DO NOT MODIFY ===== */ test("should return the highest rated book in each genre", () => { - expect(new Set(getHighestRatedInEachGenre(BOOKS))).toEqual(new Set( - [ - "The Book Your Dog Wishes You Would Read", - "Gangsta Granny Strikes Again!", - "Dishoom: The first ever cookbook from the much-loved Indian restaurant" - ] - )); -}); \ No newline at end of file + expect(new Set(getHighestRatedInEachGenre(BOOKS))).toEqual( + new Set([ + "The Book Your Dog Wishes You Would Read", + "Gangsta Granny Strikes Again!", + "Dishoom: The first ever cookbook from the much-loved Indian restaurant", + ]) + ); +}); diff --git a/3-extra/3-fibonacci.js b/3-extra/3-fibonacci.js index 9ef9aec7..6e118ff3 100644 --- a/3-extra/3-fibonacci.js +++ b/3-extra/3-fibonacci.js @@ -14,24 +14,28 @@ */ function generateFibonacciSequence(n) { - // TODO + // TODO + const fiboList = [0, 1]; + for (let i = 2; i < n; i++) { + let nextNum = fiboList[i - 2] + fiboList[i - 1]; + fiboList.push(nextNum); + } + return fiboList; } /* ======= TESTS - DO NOT MODIFY ===== */ test("should return the first 10 numbers in the Fibonacci Sequence", () => { - expect(generateFibonacciSequence(10)).toEqual( - [0, 1, 1, 2, 3, 5, 8, 13, 21, 34] - ); + expect(generateFibonacciSequence(10)).toEqual([ + 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, + ]); }); test("should return the first 5 numbers in the Fibonacci Sequence", () => { - expect(generateFibonacciSequence(5)).toEqual( - [0, 1, 1, 2, 3] - ); + expect(generateFibonacciSequence(5)).toEqual([0, 1, 1, 2, 3]); }); test("should return the first 15 numbers in the Fibonacci Sequence", () => { - expect(generateFibonacciSequence(15)).toEqual( - [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377] - ); -}); \ No newline at end of file + expect(generateFibonacciSequence(15)).toEqual([ + 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, + ]); +});