What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-28 11:36:02
typescript filter array of null
function notEmpty<TValue>(value: TValue | null | undefined): value is TValue { return value !== null && value !== undefined; } const array: (string | null)[] = ['foo', 'bar', null, 'zoo', null]; const filteredArray: string[] = array.fil... Add solution -
Javascript 2021-09-27 05:26:04
update object in array if id exists else append javascript
function upsert(array, item) { // (1) const i = array.findIndex(_item => _item.id === item.id); if (i > -1) array[i] = item; // (2) else array.push(item); } const array = [ {id: 0, name: 'Apple', description: 'fruit'}, {id: 1, name: 'Bana... Add solution -
Other 2021-09-23 11:55:02
how to send values to a selection sorting function
1 // Fig. 8.15: fig08_15.cpp 2 // This program puts values into an array, sorts the values into 3 // ascending order and prints the resulting array. 4 #include <iostream> 5 using std::cout; 6 using std::endl; 7 8 #include <iomanip&... Add solution
Best helpers
Ranking is empty