From e2ae4801028c9ff5951e79ccddc864e631d339e5 Mon Sep 17 00:00:00 2001 From: UGBODAGA IMONIKHEA FORTUNE <46460790+nikhea@users.noreply.github.com> Date: Mon, 20 Sep 2021 05:23:00 +0100 Subject: [PATCH 1/2] Create Fortune1 Challenge one done with JavaScript --- Fortune1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Fortune1 diff --git a/Fortune1 b/Fortune1 new file mode 100644 index 0000000..566ebd6 --- /dev/null +++ b/Fortune1 @@ -0,0 +1,12 @@ +const ar =[23,55,103,4,70] +const largest =maxValue(ar) +function maxValue(arr){ +let output; +if (arr === undefined || arr.length == 0) { +output = "Array is empty please add an item to the array" +} else { + let biggestNumber =Math.max(...arr) +output =`the largest number in the array is ${biggestNumber}` +} +console.log(output) +} From 02779c0308efd3facd43f98e0dcbf1ccb477f8a0 Mon Sep 17 00:00:00 2001 From: UGBODAGA IMONIKHEA FORTUNE <46460790+nikhea@users.noreply.github.com> Date: Mon, 20 Sep 2021 05:24:34 +0100 Subject: [PATCH 2/2] Create MaxValue.js Challenge one done with JavaScript --- MaxValue.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 MaxValue.js diff --git a/MaxValue.js b/MaxValue.js new file mode 100644 index 0000000..566ebd6 --- /dev/null +++ b/MaxValue.js @@ -0,0 +1,12 @@ +const ar =[23,55,103,4,70] +const largest =maxValue(ar) +function maxValue(arr){ +let output; +if (arr === undefined || arr.length == 0) { +output = "Array is empty please add an item to the array" +} else { + let biggestNumber =Math.max(...arr) +output =`the largest number in the array is ${biggestNumber}` +} +console.log(output) +}