Number.MAX_VALUE;
x = findMax(1, 123, 500, 115, 44, 88);
function findMax() {
var i;
var max = -Infinity;
for (i = 0; i < arguments.length; i++) {
if (arguments[i] > max) {
max = arguments[i];
}
}
return max;
}
Number.MAX_SAFE_INTEGER
if (penyakit === 'flu'){
let obatFlus = database.flu.obat
obatTermurah = ''
cheapest = Number.MAX_VALUE
for (let i = 0; i < obatFlus.length; i++){
let fluObat = obatFlus[i]
let obatName = fluObat[0]
let obatPrice = fluObat[1]
if(obatPrice < cheapest){
obatTermurah = obatName
cheapest = obatPrice
}
}
output = [obatTermurah, cheapest]
}
let x = Math.max(1,3,45,59,698);
console.log(x); //output 698
const findMax = (arr)=>{
let max = 0 ;
for (let index = 0; index < arr.length; index++) {
if (max < arr[index] && max != arr[index]) {
max = arr[index];
}
}
return max;
}
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)