Javascript Nuggets - Reduce (object example)
Javascript Nuggets - Reduce (object example)
Fusion Charts
www.fusioncharts.com/
Products I Use:
Microphone - Shure SM7B - amzn.to/3fX55aD
Headphones - Shure AONIC 50 - amzn.to/3zbkxHC
Desk-Mounted Microphone Stand - amzn.to/3x3MBuS
Crossover - dbx 234s - amzn.to/3xcryGC
Audio Interface - Focusrite Scarlett 2i2 3rd Gen - amzn.to/3pt1wMx
Cheaper Microphone (My first mic) - Blue Yeti USB Mic amzn.to/3iliwTm
Blue Light Blocking Glasses - amzn.to/3fZASrv
Apple MacBook Pro 13.3" - amzn.to/3z5QDEK
iMac - amzn.to/3glWmOe
Second Monitor - LG 4K UHD 27UD88 - amzn.to/3ckdwdV
Wifi Router - TP-Link AC1900 - amzn.to/34ZSddz
Desk Chair - amzn.to/3ikNbQJ
Standing Desk - amzn.to/3zdKVAJ
Books I Recommend:
The Subtle Art of Not Giving a F*ck - amzn.to/3v9t8Yi
The Tipping Point - amzn.to/3gCslKj
Atomic Habits - amzn.to/3x52xNa
12 Rules for Life - amzn.to/3gln8pN
Deep Work - amzn.to/3cyAgqu
Digital Minimalism - amzn.to/3gao69A
A World Without Email - amzn.to/351Swoe
Rich Dad Poor Dad - amzn.to/3v8RWQ6
Rich Dad's Cashflow Quadrant - amzn.to/3ivt1Uk
Check out My Amazon Store for more products and books recommendations - www.amazon.com/shop/codingaddict
Disclosure: This video is not sponsored. Some links above are affiliate links, and l may earn a small commission from any purchases at no additional cost to you. Thank you for supporting my channel!
Пікірлер: 73
You are the best in React and Javascript. Thanks, Sir for your teaching.
Another great JS nugget thanks for all the great tutorials
As always, amazing content, thank you so much! :)
Quality series from an awesome teacher to get really confident in web dev topics
Thank's John, great content
Hey thanks for this John. I've been working on a kata for a while trying to figure out how I could use reduce to return only unique values from an array of objects into a new object and even though I had to fandangle this a bit in my logic, your direction gave me the first part of the solution to my puzzle. I got such a rush when my console.log returned what I had hope for. tyvm ~Hope
This vídeo is really good 👍 Reduce's power is amazing, we can implement very interesting tasks. Thank you.
You are the best teacher ....
Thank you so much Jhon, to make it every topics so easy to grap using real time project example, you are my best coach❤
Man your explanation is stellar.... most examples of reduce are using numbers... this is really helpful sir.. cheers
This one was so cool, I learnt a ton
@CodingAddict
2 жыл бұрын
Thank you!
Thank you!!
Thank you❤
Waiting for next.js tutorial from Coding Addcit :)
you are a genius in teaching this, believe me, i see many people claiming to be the best course but the transmission method is far behind you
u r my kinda teacher i wanna learn more and more from u thank you
@vscodeaddict6607
Жыл бұрын
your channel is very under-appreciated.
@CodingAddict
Жыл бұрын
Oh, well. It is what it is :)
Hello! Thank you for this tutorial. Really useful. I am just wondering how to count number of items and "bundle" them when they are the same increasing amount...
perfect videos if we want async await and promise videos maybe they are also unclear : ) thanks again
you explain very well .2nd Example is complicated i will be watch again... make videos on slice ,splice and split
@christopherak4656
3 жыл бұрын
create a small sample of array objects for different languages and go over it again! it works. For the else statement it initialises the value to 1 before the count for the language if has not been counted yet that it why there is an empty object to set all the values to 1 before the count begins
Excellent video!!! I was wondering how you got the console.log() output to show up in your VS CODE?
@CodingAddict
Жыл бұрын
it's vs code extension called quokka.js (free version)
Nice!
On 10:19 its also possible to use the + operator to convert a string to a number like so +cartTotal.toFixed(2) Great video, thank you (:
@CodingAddict
Жыл бұрын
Great tip!
Hey man! Thanks for sharing this...also whats that adon that shows in vscode what a function rerurns or console.logs? Thanks
@CodingAddict
Жыл бұрын
extension quokka.js
What vscode extension was used here to show result on each row?
Hi, thanks for another amazing video! Can you maybe clarify what you mean by "dynamic functionality". When you talk about the input array you also said it's not going to be dynamic. Could you explain how dynamic would work? Or do you cover that in some other videos?
@CodingAddict
3 жыл бұрын
Hi, it means that in this case we have a static value of cart. In react project cart value is changing when we click buttons but the functionality to count the totals is still the same (our function)
What if i want to get unique object key's from arrays of objects is it possible to do this in reduce method? Kindly guide me thankyou
Thanks sir, it’s a great video, what extension are you using to show the console log output?
@CodingAddict
2 жыл бұрын
quokka.js
Can you tell me what is this syntax "total[language]" I am confused
Man, How didn't I know you earlier ;(
woow!!!
Great video! By the way, what's the extension for VS Code that shows the function results? Thank you!
@CodingAddict
3 жыл бұрын
quokka.js
@olegg1082
3 жыл бұрын
This must be trolling at this point. This question is being asked and answered under literally every video and often multiple times.
@brutalv4
3 жыл бұрын
@@olegg1082 no trolling at all =)
@deveighteen6302
2 жыл бұрын
@@olegg1082 you meant "trending" ?
@deveighteen6302
2 жыл бұрын
I guess he meant "trending"
great video it will be realy amayzing if you could find time to do some back end tuttorial like node.js and mongodb it will help in increasing the coding addict community and i hope the day come when this chaneal hit the 1million subscriber
hey what is that const{amount, price} can u explain me to please
what extension are you using for the alarts?
@CodingAddict
3 жыл бұрын
If you mean console.log - quokka
Can we also go over *forEach* in this series just for the sake of completeness?
@CodingAddict
3 жыл бұрын
Hey Ivan, emm we will see, at the moment I have only one more planned
response.json() / res.json() // Despite the method being named json(), the result is not JSON but is instead the result of taking JSON as input and parsing it to produce a JavaScript object. "Parse as JSON" means analyze it in JSON format - but JS is returned
John.... JOHN... Notice MEEEEE! You are MY HERO... !
Hey John, do you know why I keep getting "fetch is not defined in VSCODE". I even copy pasted your code and still says fetch is not defined. It's like I'm missing a package or something but I thought fetch was built in
@CodingAddict
2 жыл бұрын
It's probably something to do with your settings.
@shellbot972
2 жыл бұрын
got it resolved by installing node-fetch version 2 : npm install node-fetch@2
|| 1 ? It is very clever.
I get fetch is not defined can you help me?
@khushiujjawal3668
2 жыл бұрын
global.fetch = require("node-fetch");
@irsyadrdp
2 жыл бұрын
@@khushiujjawal3668 Thank you !!!
Hi, what kind of extension which shows answer ,,, please,,,
@CodingAddict
Жыл бұрын
quokka.js
When you add parseFloat() at 10:18 it breaks toFixed(2) and makes cartTotal = 5599.9 (line 43): cartTotal = parseFloat(cartTotal.toFixed(2)) But if I do 'cartTotal = parseFloat(cartTotal).toFixed(2)' then cartTotal = 5599.90 in fact, passing any number into parseFloat(cartTotal.toFixed(number)) from 1 - 11 will result in 5599.9, while passing any number greater than 12 will result in 5599.90 Why is that?
@CodingAddict
2 жыл бұрын
Hmm. I'm really not sure :)
this is a pretty difficult topic for me to grasp
cart array, just to not rewrite it :) ``` const cart = [ { title: "Samsung Galaxy S7", price: 599.99, ammount: 1 }, { title: "google pixel", price: 499.99, ammount: 2 }, { title: "Xaiomi Redmi Note 2", price: 699.99, ammount: 4 }, { title: "Xaiomi Redmi Note 5", price: 399.99, ammount: 3 }, ]; ```
The one who dislike the video will be surely from your family.
@CodingAddict
3 жыл бұрын
why?
@olegg1082
3 жыл бұрын
What do you mean?
@MultiAlifarooq
3 жыл бұрын
It was a sarcasm....You will not get because mostly in Asian countries family members like cousin don't appreciate your efforts..I m learning a lot from you...
@CodingAddict
3 жыл бұрын
Ha ha. Thank you for info
I came for the tacos and burritos
Killer language decision: language && (total[language] = total[language] + 1 || 1); //