What is the result of Math.max() is greater than Math.min()
Can someone please explain? I learn something new about JS everyday !
if (Math.min() < Math.max())
console.log("if block?")
else
console.log("or else block?")
[spoiler alert] The idea is that if
A={a1, a2, ...}
B={b1, b2, ...}
are sets, then min(union(A, B)) = min(min(A), min(B))
I don't expect this code will not compile as is in any language, but I hope it's understandable enough.The what happens if A is the empty set? if we define
x = min(empty)
then min(union(empty, B)) = min(B)
min(min(empty), min(B)) = min(x, min(B)
so min(B) = min(x, min(B))
Then x must be a number big enough to be bigger than min(B) for any set B. But min(B) can be very big if B has only big numbers, so the only possibility is that x = +infinity.Min is assigned Ininity Max is assigned -Infinity
To test just run the logic on chrome console.