TOTAL - 40
Sum values in object arrays
Input:
{ food: [10, 20, 30], travel: [5, 15], bills: [40, 60] }
Output:
{ food: 60, travel: 20, bills: 100 }
Count word occurrences in array
Input:
["apple", "banana", "apple", "orange", "banana", "apple"]
Output:
{ apple: 3, banana: 2, orange: 1 }
Swap keys and values of object
Input:
{ a: "x", b: "y", c: "z" }
Output:
{ x: "a", y: "b", z: "c" }
Find the largest value key
Input:
{ a: 10, b: 50, c: 20 }
Output:
b
Flatten object of arrays into one array
Input:
{ fruits: ["apple", "banana"], veggies: ["carrot", "pea"] }
Output:
["apple", "banana", "carrot", "pea"]
Group people by city
Input:
[
{ name: "A", city: "Delhi" },
{ name: "B", city: "Mumbai" },
{ name: "C", city: "Delhi" }
]
Output:
{ Delhi: ["A", "C"], Mumbai: ["B"] }
Filter object by values > 50
Input:
{ a: 20, b: 60, c: 40, d: 90 }
Output:
{ b: 60, d: 90 }
Find student with highest average mark
Input:
{ A: [80, 90], B: [70, 75, 85] }
Output:
A
Unique values across all object arrays
Input:
{ x: [1,2,3], y: [2,3,4], z: [4,5] }
Output:
[1,2,3,4,5]
Pick only given keys from object
Input:
{ name: "Rahul", age: 23, city: "Noida" }, ["name","city"]
Output:
{ name: "Rahul", city: "Noida" }
Find student with highest average marks
Input:
{ A: [80, 90], B: [70, 75, 85] }
Output:
A
Sort object entries by values (ascending)
Input:
{ a: 3, b: 1, c: 2 }
Output:
[["b",1], ["c",2], ["a",3]]
Count number of keys in object
Input:
{ a: 1, b: 2, c: 3 }
Output:
3
Capitalize string values inside object
Input:
{ name: "alice", city: "delhi" }
Output:
{ name: "Alice", city: "Delhi" }
Convert object to query string
Input:
{ name: "Alice", age: 25 }
Output:
"name=Alice&age=25"
Count even and odd numbers in array
Input:
[1,2,3,4,5,6]
Output:
Find common keys between two objects
Convert array of objects to lookup by id