Тёмный

JavaScript ARRAYS of OBJECTS are easy! 🍎 

Bro Code
Подписаться 2,1 млн
Просмотров 20 тыс.
50% 1

Опубликовано:

 

12 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 20   
@BroCodez
@BroCodez 10 месяцев назад
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);
@k00lmoh
@k00lmoh 9 месяцев назад
yo this channel is amazing, why is it heavily underrated wtf, keep going man!
@joehaar1466
@joehaar1466 9 месяцев назад
The best tutorials I could fine. Just wanna say thank you. Currently learning Python with your lessons.
@AviShpayer
@AviShpayer 4 месяца назад
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."
@thoughten
@thoughten 3 месяца назад
Lol. I thought the same too. In the end,it's just another way to write a for loop
@elawet435
@elawet435 9 месяцев назад
You’re amazing dude, thank u ❤
@navnitkhandait6750
@navnitkhandait6750 7 месяцев назад
this man making it very easy to learn complex topics in very esy way
@jayboy6430
@jayboy6430 Месяц назад
Best clarification by far. I've now subscribed.
@piotrmazgaj
@piotrmazgaj 19 дней назад
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.
@user-vb2pq6fo9x
@user-vb2pq6fo9x 7 дней назад
hope you are trying to write the code in vs code at the end of every video
@peterarcuri3291
@peterarcuri3291 5 месяцев назад
Bro Code you're awesome!! Thank you for the wisdom!
@hunin27
@hunin27 9 месяцев назад
thanks bro
@Tiger__Man
@Tiger__Man 7 месяцев назад
Hey brocode thanks for this do u have a long video about the same subject im still confused with those => :
@peterarcuri3291
@peterarcuri3291 5 месяцев назад
'grapges' 😂
@idontknowwhattonamethischa4592
@idontknowwhattonamethischa4592 9 месяцев назад
FRUITS
@friedricht3908
@friedricht3908 9 месяцев назад
First
@Abde473
@Abde473 4 месяца назад
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.
@hamzagohar2048
@hamzagohar2048 2 месяца назад
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
@user-ib8ek4fc4i
@user-ib8ek4fc4i 2 месяца назад
bro
@navnitkhandait6750
@navnitkhandait6750 7 месяцев назад
this man making it very easy to learn complex topics in very esy way
Далее
Learn JavaScript SORTING in 6 minutes! 🗃
6:42
Просмотров 23 тыс.
JavaScript GETTERS & SETTERS are awesome!!! 📐
13:14
a hornet bit me on the nose 👃😂
00:16
Просмотров 2,6 млн
Cursor Is Beating VS Code (...by forking it)
18:00
Просмотров 93 тыс.
Learn how JavaScript COOKIES work! 🍪
14:15
Просмотров 51 тыс.
Array Methods in JavaScript | 17 Useful Methods
42:39
Learn JavaScript INHERITANCE in 7 minutes! 🐇
7:04
What is THIS in JavaScript? 👈
4:27
Просмотров 18 тыс.
How to FETCH data from an API using JavaScript ↩️
14:17
PROPS in React explained 📧
12:09
Просмотров 81 тыс.
Learn JavaScript CALLBACKS in 7 minutes! 🤙
7:17
Просмотров 51 тыс.
Learn JavaScript WHILE LOOPS in 8 minutes! 🔁
8:12