Reduce Revision - (Day 11 - Reduce Revision)
Count how many words start with a vowel using reduce:
const words = ['apple', 'banana', 'orange', 'grape', 'umbrella'];
Find the smallest odd number in this array using reduce:
const numbers = [11, 6, 3, 9, 14];
Find the smallest even number in this array using reduce:
const numbers = [11, 6, 3, 9, 14];
Count how many fruits contain the letter 'e' using reduce:
const fruits = ['apple', 'banana', 'grape', 'kiwi'];
Count how many times the number 5 appears in this array using reduce:
const numbers = [5, 2, 5, 7, 5, 9]
Find the sum of only even numbers in this array using reduce:
const numbers = [4, 7, 10, 13, 16]
Objects
Objects are key value pair. eg.
const person = {name: "Ram", age: 30, location: "Kathmandu", height: 6};
Task - Create any two objects that you like, but dont make it very simple one like {one: 1, two: 2}. Try to think as it it is useful in real world.
How to create and empty object - 2 ways
const fruit = {};
const car = new Object();
What are object properties ?