Skip to content
Advertisement

An array is monotonic if it is either monotone increasing or monotone decreasing

JavaScript

Can anyone please explain how the return value is working.

Advertisement

Answer

increasing || decreasing means increasing OR decreasing. If either variable is true then the whole method will return true, otherwise it will return false.

|| is the logical OR operator.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement