What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2022-03-27 17:05:06
use of slice and splice add elements array
function frankenSplice(arr1, arr2, n) { // Create a copy of arr2. let combinedArrays = arr2.slice() // [4, 5, 6] // Insert all the elements of arr1 into arr2 beginning // at the index specified by n. We're using the spread /... Add solution -
Javascript 2022-03-16 23:45:12
permutaciones con repeticion javascript
function permutator (input) { var set =[]; function permute (arr, data) { var cur, memo = data || []; for (var i = 0; i < arr.length; i++) { cur = arr.splice(i, 1)[0]; if (arr.length === 0) set.push(memo.concat([cur])); ... Add solution -
Javascript 2022-01-22 17:41:29
es6 reverse foreach
var arr = [1, 2, 3, 4, 5]; arr.slice().reverse() .forEach(function(item) { console.log(item);  ... Add solution -
Javascript 2021-11-18 23:39:17
copy one array to another javascript
/* Copying arrays or parts of arrays in JavaScript */ var fruit = ["apple", "banana", "fig"]; // Define initial array. console.log(fruit); // ["apple", "banana", "fig"] // Copy an entire array ... Add solution -
Ruby 2021-11-16 05:21:19
Ruby exclude from slice
# First of all you have to use splat (*) operator. # Then instead of using .slice() and .except() together, you can do this is more efficient way. columns_to_show = ['age', 'gender', 'cast', 'fee_status'] columns_to_show = columns_to_show - hidden_colum... Add solution -
Javascript 2021-10-19 13:03:12
array reverse without mutating
var newarray = array.slice().reverse(); Add solution