From 8a2ec12db6d90f058a09d23f155448319f3fb35a Mon Sep 17 00:00:00 2001
From: JuHaoChen1997 <juhaochen97@gmail.com>
Date: Sat, 24 Sep 2022 20:59:53 -0400
Subject: [PATCH] finish lab

---
 solution.js | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/solution.js b/solution.js
index 049257f..246126d 100644
--- a/solution.js
+++ b/solution.js
@@ -1,72 +1,86 @@
 const { nums, words } = require("./data/data.js");
 
 // Every
-const isEveryNumGreaterThan2 = () => {
+const isEveryNumGreaterThan2 = (nums) => {
   //
+  return nums.every((num) => num >= 2);
 };
 
-const isEveryWordShorterThan7 = () => {
+const isEveryWordShorterThan7 = (words) => {
   //
+  return words.every((word) => word.length < 7);
 };
 
 // Filter
 
-const arrayLessThan5 = () => {
+const arrayLessThan5 = (nums) => {
   //
+  return nums.filter((num) => num < 5);
 };
 
-const arrayOddLengthWords = () => {
+const arrayOddLengthWords = (words) => {
   //
+  return words.filter((word) => word.length % 2 === 1);
 };
 
 // Find
 
-const firstValDivisibleBy4 = () => {
+const firstValDivisibleBy4 = (nums) => {
   //
+  return nums.find((num) => num % 4 === 0);
 };
 
-const firstWordLongerThan4Char = () => {
+const firstWordLongerThan4Char = (words) => {
   //
+  return words.find((word) => word.length > 4);
 };
 
 // Find Index
 
-const firstNumIndexDivisibleBy3 = () => {
+const firstNumIndexDivisibleBy3 = (nums) => {
   //
+  return nums.findIndex((num) => num % 3 === 0);
 };
 
-const firstWordIndexLessThan2Char = () => {
+const firstWordIndexLessThan2Char = (words) => {
   //
+  return words.findIndex((word) => word.length < 2);
 };
 
 // For Each
 
-const logValuesTimes3 = () => {
+const logValuesTimes3 = (nums) => {
   //
+  nums.forEach((num) => console.log(nums * 3));
 };
 
-const logWordsWithExclamation = () => {
+const logWordsWithExclamation = (words) => {
   //
+  words.forEach((word) => console.log(word + "!"));
 };
 
 // Map
 
-const arrayValuesSquaredTimesIndex = () => {
+const arrayValuesSquaredTimesIndex = (nums) => {
   //
+  return nums.map((num, index) => num * num * index);
 };
 
-const arrayWordsUpcased = () => {
+const arrayWordsUpcased = (words) => {
   //
+  return words.map((word) => word.toUpperCase());
 };
 
 // Some
 
-const areSomeNumsDivisibleBy7 = () => {
+const areSomeNumsDivisibleBy7 = (nums) => {
   //
+  return nums.some((num) => num % 7 === 0);
 };
 
-const doSomeWordsHaveAnA = () => {
+const doSomeWordsHaveAnA = (words) => {
   //
+  return words.some((word) => word.includes("a"));
 };
 
 module.exports = {