Being used to Python, I am looking for a min
function in Javascript that would accept a list and returns the minimum value in the list.
This is as easy as minimum = min([4, 4, 3, 2, 1])
I only found Math.min()
which accepts a comma delimited argument list as described in MDN.
To make this behave like Python's min
function, here's when apply
comes in handy.
let minimum = Math.min.apply(this, [4, 4, 3, 2, 1]);
@andrewartajos