What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-08-31 13:38:01
javascript copy items into another array
/* 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 -
Javascript 2021-08-31 07:29:02
sub array javascript
// array.slice(start, end) const FRUITS = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; var citrus = FRUITS.slice(1, 3); // citrus => [ 'Orange', 'Lemon' ] // Negative values slice in the opposite d... Add solution -
Shell/Bash 2021-08-30 10:43:02
simple way to make a text field to accept numbers only with maximum number of length 13 digit and min 10
<input name="phoneNumber" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" type = "number" maxlength = "10" /> Add solution -
Javascript 2021-08-30 03:06:01
array peremutation js recursion
const permutations = arr => { if (arr.length <= 2) return arr.length === 2 ? [arr, [arr[1], arr[0]]] : arr; return arr.reduce( (acc, item, i) => acc.concat( permutations([...arr.slice(0, i), ...arr.slice(i + 1)]).map(val =&g... Add solution