Thank you for the video. There was one thing in the video that I didn't understand and had to ask chatGPT about it. When you name the parameter in the filters as "fruit" instead of "fruits" I didn't understand how did that work, I thought it should be fruits in plural. I even thought that maybe Javascript understands singular from plural. Luckly, chatGPT explained it: "Whether you name this parameter fruit or fruits or anything else doesn't affect how JavaScript processes the code. It's just a variable name."
Hey bro, no offense intended, but it seems like you always tend to spend more time elaborating on simple concepts while rushing through the more challenging aspects of what you're teaching. Just an observation.
yea it does feel like that probably because it is a recording not a live lecture where we can ask and clarify i usually get help if i feel stuck by using chatgpt
const fruits = [ {name: "apple", color: "red", calories: 95},
{name: "orange", color: "orange", calories: 45},
{name: "banana", color: "yellow", calories: 105},
{name: "coconut", color: "white", calories: 159},
{name: "pineapple", color: "yellow", calories: 37}];
// Access properties of a fruit object
console.log(fruits[0].calories);
// Add a new fruit object
fruits.push({ name: "grapes", color: "purple", calories: 62});
// Remove the last fruit object
fruits.pop();
// Remove fruit objects by indices
fruits.splice(1, 2);
// ---------- forEach() ----------
fruits.forEach(fruit => console.log(fruit));
fruits.forEach(fruit => console.log(fruit.name));
fruits.forEach(fruit => console.log(fruit.color));
fruits.forEach(fruit => console.log(fruit.calories));
// ---------- map() ----------
const fruitNames = fruits.map(fruit => fruit.name);
const fruitColors = fruits.map(fruit => fruit.color);
const fruitCalories = fruits.map(fruit => fruit.calories);
console.log(fruitNames);
console.log(fruitColors);
console.log(fruitCalories);
// ---------- filter() ----------
const yellowFruits = fruits.filter(fruit => fruit.color === "yellow");
const lowCalFruits = fruits.filter(fruit => fruit.calories < 100);
const highCalFruits = fruits.filter(fruit => fruit.calories >= 100);
console.log(yellowFruits);
console.log(lowCalFruits);
console.log(highCalFruits);
// ---------- reduce() ----------
const maxFruit = fruits.reduce( (max, fruit) =>
fruit.calories > max.calories ?
fruit : max);
const minFruit = fruits.reduce( (min, fruit) =>
fruit.calories < min.calories ?
fruit : min);
console.log(maxFruit);
console.log(minFruit);
yo this channel is amazing, why is it heavily underrated wtf, keep going man!
The best tutorials I could fine. Just wanna say thank you. Currently learning Python with your lessons.
this man making it very easy to learn complex topics in very esy way
Best clarification by far. I've now subscribed.
You’re amazing dude, thank u ❤
Thank you for the video. There was one thing in the video that I didn't understand and had to ask chatGPT about it.
When you name the parameter in the filters as "fruit" instead of "fruits" I didn't understand how did that work, I thought it should be fruits in plural. I even thought that maybe Javascript understands singular from plural.
Luckly, chatGPT explained it:
"Whether you name this parameter fruit or fruits or anything else doesn't affect how JavaScript processes the code. It's just a variable name."
absolutely amazing and easy to understand
Bro Code you're awesome!! Thank you for the wisdom!
This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.
hope you are trying to write the code in vs code at the end of every video
thanks bro
Hey brocode thanks for this do u have a long video about the same subject im still confused with those
=> :
'grapges' 😂
FRUITS
First
Hey bro, no offense intended, but it seems like you always tend to spend more time elaborating on simple concepts while rushing through the more challenging aspects of what you're teaching. Just an observation.
yea it does feel like that probably because it is a recording not a live lecture where we can ask and clarify i usually get help if i feel stuck by using chatgpt
bro
this man making it very easy to learn complex topics in very esy way