diff --git a/Test/1/array-exersise-1.js b/Exercises/day-1/array-exersise-1.js similarity index 100% rename from Test/1/array-exersise-1.js rename to Exercises/day-1/array-exersise-1.js diff --git a/Test/1/array-exersise-2.js b/Exercises/day-1/array-exersise-2.js similarity index 100% rename from Test/1/array-exersise-2.js rename to Exercises/day-1/array-exersise-2.js diff --git a/Test/1/object-exercise-1.js b/Exercises/day-1/object-exercise-1.js similarity index 100% rename from Test/1/object-exercise-1.js rename to Exercises/day-1/object-exercise-1.js diff --git a/Exercises/day-1/object-exercise-2.js b/Exercises/day-1/object-exercise-2.js new file mode 100644 index 0000000..cd3beff --- /dev/null +++ b/Exercises/day-1/object-exercise-2.js @@ -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. \ No newline at end of file