Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Fortune1
Original file line number Diff line number Diff line change
@@ -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)
}
12 changes: 12 additions & 0 deletions MaxValue.js
Original file line number Diff line number Diff line change
@@ -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)
}