From 71852224643665163f5d5db6a08f6dbe67234321 Mon Sep 17 00:00:00 2001 From: "T.K" Date: Mon, 17 Oct 2022 20:39:33 -0400 Subject: [PATCH] passed all tests --- solution.js | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/solution.js b/solution.js index 049257f..bef9eee 100644 --- a/solution.js +++ b/solution.js @@ -2,71 +2,85 @@ const { nums, words } = require("./data/data.js"); // Every const isEveryNumGreaterThan2 = () => { - // + let result = nums.every((e) => e > 2); + return result; }; const isEveryWordShorterThan7 = () => { - // + let result = words.every((e) => e.length < 7); + return result; }; // Filter const arrayLessThan5 = () => { - // + let result = nums.filter((f) => f < 5); + return result; }; const arrayOddLengthWords = () => { - // + let result = words.filter((f) => f.length % 2 !== 0); + return result; }; // Find const firstValDivisibleBy4 = () => { - // + let result = nums.find((f) => f % 4 === 0); + return result; }; const firstWordLongerThan4Char = () => { - // + let result = words.find((f) => f.length > 4); + return result; }; // Find Index const firstNumIndexDivisibleBy3 = () => { - // + let result = nums.findIndex((i) => i % 3 === 0); + return result; }; const firstWordIndexLessThan2Char = () => { - // + let result = words.findIndex((i) => i.length < 2); + return result; }; // For Each const logValuesTimes3 = () => { - // + let result = nums.forEach((e) => e * 3); + return result; }; const logWordsWithExclamation = () => { - // + let result = words.forEach((e) => e.includes("!")); + return result; }; // Map const arrayValuesSquaredTimesIndex = () => { - // + let result = nums.map((m, i) => (m ** 2) * i); + return result; }; const arrayWordsUpcased = () => { - // + let result = words.map((m) => m.toUpperCase()); + return result; }; // Some const areSomeNumsDivisibleBy7 = () => { - // + let result = nums.some((s) => s % 7 === 0); + return result; }; const doSomeWordsHaveAnA = () => { - // + let result = words.some((s) => s.includes("a")); + return result; }; module.exports = {