parent
9028b4c5a4
commit
2c65f62402
@ -0,0 +1,74 @@
|
|||||||
|
const users = {
|
||||||
|
Alex: {
|
||||||
|
email: 'alex@alex.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript'],
|
||||||
|
age: 20,
|
||||||
|
isLoggedIn: false,
|
||||||
|
points: 30
|
||||||
|
},
|
||||||
|
Asab: {
|
||||||
|
email: 'asab@asab.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'Redux', 'MongoDB', 'Express', 'React', 'Node'],
|
||||||
|
age: 25,
|
||||||
|
isLoggedIn: false,
|
||||||
|
points: 50
|
||||||
|
},
|
||||||
|
Brook: {
|
||||||
|
email: 'daniel@daniel.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux'],
|
||||||
|
age: 30,
|
||||||
|
isLoggedIn: true,
|
||||||
|
points: 50
|
||||||
|
},
|
||||||
|
Daniel: {
|
||||||
|
email: 'daniel@alex.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'Python'],
|
||||||
|
age: 20,
|
||||||
|
isLoggedIn: false,
|
||||||
|
points: 40
|
||||||
|
},
|
||||||
|
John: {
|
||||||
|
email: 'john@john.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'React', 'Redux', 'Node.js'],
|
||||||
|
age: 20,
|
||||||
|
isLoggedIn: true,
|
||||||
|
points: 50
|
||||||
|
},
|
||||||
|
Thomas: {
|
||||||
|
email: 'thomas@thomas.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'React'],
|
||||||
|
age: 20,
|
||||||
|
isLoggedIn: false,
|
||||||
|
points: 40
|
||||||
|
},
|
||||||
|
Paul: {
|
||||||
|
email: 'paul@paul.com',
|
||||||
|
skills: ['HTML', 'CSS', 'JavaScript', 'MongoDB', 'Express', 'React', 'Node'],
|
||||||
|
age: 20,
|
||||||
|
isLoggedIn: false,
|
||||||
|
points: 40
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Find the person who has many skills in the users object.
|
||||||
|
let maxskill =0
|
||||||
|
let mostskilledperson=null
|
||||||
|
for (const user in users){
|
||||||
|
const skillcount = users[user].skills.length
|
||||||
|
if (skillcount > maxskill){
|
||||||
|
maxskill = skillcount
|
||||||
|
mostskilledperson = user
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(`The person with the most skills is ${mostskilledperson} with ${maxskill} skills.`)
|
||||||
|
|
||||||
|
// Count logged in users,count users having greater than equal to 50 points from the following object.
|
||||||
|
|
||||||
|
// Find people who are MERN stack developer from the users object
|
||||||
|
|
||||||
|
// Set your name in the users object without modifying the original users object
|
||||||
|
|
||||||
|
// Get all keys or properties of users object
|
||||||
|
|
||||||
|
// Get all the values of users object
|
||||||
|
|
||||||
|
// Use the countries object to print a country name, capital, populations and languages.
|
Loading…
Reference in new issue