What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-18 07:30:11
reverse keys and values in object javascript
//The concise way by using ES6 syntax like this. const obj = {A : 1, B : 2, C : 3, D : 4} function objectFlip(obj) { return Object.entries(obj).reduce((acc, [key, value]) => (acc[value] = key, acc), {}) } console.log('input: ',obj); console.lo... Add solution -
Javascript 2022-03-11 05:30:33
javascript for group object properties based on another property
var list = [ { date: "2017-01-01", type: "type1", amount: 100 }, { date: "2017-01-01", type: "type2", amount: 150 }, { date: "2017-01-02",... Add solution -
TypeScript 2022-01-25 22:01:41
Return the Objects Keys and Values
const keysAndValues = (obj) => [Object.keys(obj), Object.values(obj)]; keysAndValues({a: 1, b: 2, c: 3}); //➞ [["a", "b", "c"], [1, 2, 3]] keysAndValues({a: "Dell", b: "Microsoft", c: "Google&qu... Add solution