What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-17 10:00:12
Math max with array js
// For large data, it's better to use reduce. Supose arr has a large data in this case: const arr = [1, 5, 3, 5, 2]; const max = arr.reduce((a, b) => { return Math.max(a, b) }); // For arrays with relatively few elements you can use apply: const max ... Add solution -
Javascript 2022-02-28 15:15:06
lerp javascript
export function lerp(v0, v1, amt, maxMove = 0, minDiff = 0.0001) { let diff = v1 - v0; if (maxMove > 0) { diff = Math.min(diff, maxMove); diff = Math.max(diff, -maxMove); } if (Math.abs(diff) < minDiff) { return v1; } return v0 + diff * ... Add solution -
Javascript 2022-02-26 18:35:07
js max array
// For large data, it's better to use reduce. Supose arr has a large data in this case: const arr = [1, 5, 3, 5, 2]; const max = arr.reduce((a, b) => { return Math.max(a, b) }); // For arrays with relatively few elements you can use apply: const max ... Add solution -
Javascript 2022-02-24 15:50:02
maximum element in an array javascript
// For large data, it's better to use reduce. Supose arr has a large data in this case: const arr = [1, 5, 3, 5, 2]; const max = arr.reduce((a, b) => { return Math.max(a, b) }); // For arrays with relatively few elements you can use apply: const max ... Add solution -
Java 2022-02-17 13:05:06
math maximum java
Math.max(a, b); // a & b = int, double, float, or long Add solution -
Javascript 2022-02-14 15:30:11
find least common multiple javascript
function smallestCommons(arr) { var max = Math.max(...arr); var min = Math.min(...arr); var candidate = max; var smallestCommon = function(low, high) { // inner function to use 'high' variable function scm(l, h) { if (h % l === 0) {... Add solution
Best helpers
Eric Vought
+5
James Song
+5
Fishbean
+5
Mai Rose
+5
Bunch
+5
Bob R Bogle
+5
Gruppetto
+5
Katboodle
+5
Vidhi Patel
+5
Buttercup
+5
Bin Nguyễn
+5