
Not in Order
You are given an array of numbers. Your function should return the number of elements, which are not at their places as if the array would be sorted ascending. For example, for the sequence [1, 1, 4, 2, 1, 3] the result is 3, since elements at indexes 2, 4, 5 (remember about 0-based indexing in JavaScript) are not at their places as in the same sequence sorted ascending - [1, 1, 1, 2, 3, 4].
Input: Array of integers (number).
Output: Integer (number).
Examples:
assert.strictEqual(notOrder([1, 1, 4, 2, 1, 3]), 3); assert.strictEqual(notOrder([]), 0); assert.strictEqual(notOrder([1, 1, 1, 1, 1]), 0); assert.strictEqual(notOrder([1, 2, 3, 4, 5]), 0);