What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-01 06:08:01
javascript sort descending
// Sort an array of numbers let numbers = [5, 13, 1, 44, 32, 15, 500] // Lowest to highest let lowestToHighest = numbers.sort((a, b) => a - b); //Output: [1,5,13,15,32,44,500] //Highest to lowest let highestToLowest = numbers.sort((a, b) => b-a);... Add solution -
Javascript 2021-09-01 03:16:02
filter object javascript es6
// use filter() function. Let say we have array of object. let arr = [ {name: "John", age: 30}, {name: "Grin", age: 10}, {name: "Marie", age: 50}, ]; //Now I want an array in which person having age more than 40 is not ... Add solution -
Shell/Bash 2021-08-31 12:25:01
bash array
# create an array - just assign first value arrayname[0]='VALUE' # define an array declare -a arrayname=(element1 element2 element3) # get array element at index ${arrayname[2]} # get all array elements ${arrayname[@]} # get array length ${#arrayname... Add solution -
Javascript 2021-08-30 09:26:01
react call bind apply
.bind() is used to call a function with a given context. Using .bind() won’t call the function, only modifies the context. .call() and .apply() will call the function immediately and modifies the context. The difference between the two: .call() ac... Add solution
Best helpers
Ranking is empty