---
# System prepended metadata

title: Aashish Shrivastava

---

# Aashish Shrivastava


- Javascript
- MongoDb, SQL

# Question 1: Js 
```javascript=
const arrObj = [
    { age: 9, class: 6, name: 'A'},
    { age: 10, class: 5, name: 'B'},
    { age: 11, class: 6, name: 'C'},
    { age: 10, class: 5, name: 'D'},
    { age: 12, class: 6, name: 'E'},
    { age: 10, class: 5, name: 'F'},
    { age: 12, class: 7, name: 'G'},
]

let myObj ={}

arr.forEach((item)=>{
   
   if(myObj[item.age]){
       myObj[age] =  [...myObj[item.name]]
   }
})

console.log(myObj)

// const result = {
//     5: {
//         10: ['B', 'D', 'F']
//     },
//     6: {
//         9: ['A'],
//         11: ['C'],
//         12: ['E']
//     },
//     7: {
//         12: ['G']
//     }
// }




```