What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-04 21:47:19
javascript every other element in array
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; // filter out all elements that are located at an even index in the array. let x = arr.filter((element, index) => { return index % 2 === 0; }) console.log(x) // [1, 3, 5, 7, 9] Add solution -
Javascript 2021-10-23 13:42:09
primitive and non primitive data types in javascript
//primitive = {STRING, NUMBER, BOOLEAN, SYMBBOL, UNDEFIEND, NULL} //non-primitive = {ARRAY, OBJECT, FUNCTION} //primitive is always copied by VALUE var a = 1; var b = a; //console.log(a , b) = 1 , 1 a = 3; console.log(a) //3 console.log(b) // still ... Add solution