What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-27 18:05:27
array chunk javascript
function splitArrayIntoChunksOfLen(arr, len) { var chunks = [], i = 0, n = arr.length; while (i < n) { chunks.push(arr.slice(i, i += len)); } return chunks; } var alphabet=['a','b','c','d','e','f']; var alphabetPairs=splitArrayIntoC... Add solution -
Javascript 2022-03-16 17:40:23
javascript get elements that exist in two arrays
function getArraysIntersection(a1,a2){ return a1.filter(function(n) { return a2.indexOf(n) !== -1;}); } var colors1 = ["red","blue","green"]; var colors2 = ["red","yellow","blue"]; var ... Add solution -
Other 2022-02-23 03:40:20
how to display an array in one message dialog
public static void printArray(double[] array) { StringBuilder builder = new StringBuilder(); for (int a = 0; a < array.length; a++) { builder.append(array[a]).append(" "); } JOptionPane.showMessageDialog(null, builder.... Add solution -
TypeScript 2022-02-22 15:45:01
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
function adjacentElementsProduct(inputArray) { var cb = Number.NEGATIVE_INFINITY; for(var i=0;i<inputArray.length-1;i++){ if(inputArray[i]*inputArray[i+1] > cb){ cb = inputArray[i]*inputArray[i+1]; } } return ... Add solution
Best helpers
Ranking is empty