Module exports in Node.js explained - Node.js Basics [09] - Java Brains

  Рет қаралды 54,307

Java Brains

Java Brains

Күн бұрын

Have you seen the new Java Brains? Check out www.javabrains.io now for awesome courses and content!
Learn how to export your objects and functions from your Node.js scripts. Learn how to make your code elements in one file accessible in another file.
Java Brains website: javabrains.io
Access the full course playlist here:
• NodeJS Basics
#JavaBrains #Node.js #JavaScript #Tutorial

Пікірлер: 90
@nabeelyousafpasha
@nabeelyousafpasha 4 жыл бұрын
You actually did clear my concepts regarding Require, Exports, etc. I was stuck in those. Thanks alot. Respect from Pakistan 🇵🇰
@prajwalwarad3318
@prajwalwarad3318 3 жыл бұрын
@Brayden Kashton U r noob..
@nezukoonemill4153
@nezukoonemill4153 3 жыл бұрын
@@prajwalwarad3318 Xi PingPong
@ganeshradiga
@ganeshradiga 4 жыл бұрын
After watching this video, was just curios and went to check which was your first video, when was it uploaded and hows the tutorial. You have come a long way in these 9 years. you have helped thousands of people, if not millions throughout your journey. I have taken numerous courses throughout my career live and online, Nobody has mastered the art of explaining the topics with such simplicity in short span of time as much you have done. I sincerely thank you for all your effort in making the tutorials. Wish you loads of luck in you personal and professional front. Keep up your good work.
@benjaminaboagye9807
@benjaminaboagye9807 2 жыл бұрын
I 100% agree with you @Ganesh. His explanations are how it should be taught both in class and in books!!!
@frantzbazile1554
@frantzbazile1554 4 жыл бұрын
Why is this not in W3SCHOOLS??!! Thanks so much @JavaBrains / @koushik!!!! Finally I see someone breakdown the many different ways of exporting in JS. Thx for making this clear as I'm coming from the world of Java
@hyperborean72
@hyperborean72 4 жыл бұрын
Could someone explain me please why after rewriting exports.add as (a,b) => a+b we had to change the call from another .js as var {a} by adding figure brackets? What had changed? It seems that whatever we assign to exports.add it has always been a reference to function, just different ways to write it - so why do we need to add {}? Probably it somehow let us call imported function no as add.add(x, y) but as add(x,y) - but why?
@LijoMLoyid
@LijoMLoyid 4 жыл бұрын
An object is returned from the add.js file. What he is doing by using {} is destructuring the object which is returned so that add gets the value of the object returned. So he is able to call add(10,20) directly. Just look up "JavaScript Object destructuring" in google and you can find more such examples to get a clear understanding of the concept
@saucy05
@saucy05 2 жыл бұрын
This dude is the best coding teacher on KZbin. He just has a way of breaking things down to the basics to make them digestable.
@channel23653
@channel23653 3 жыл бұрын
// var exports = module.exports; this line transformed my darkness into the light. 💡
@a_maxed_out_handle_of_30_chars
@a_maxed_out_handle_of_30_chars Жыл бұрын
thank you :) 8:20, this is what I had issue with
@AnanDNavalar
@AnanDNavalar 4 жыл бұрын
Team, What happened?? No updates after these tutorials. We all waiting for ur upcoming sessions
@narayanamt9534
@narayanamt9534 4 жыл бұрын
Thanks, Koushik. You have demystified JS. I recommend all beginners should watch this video to get a better understanding of the subject. Keep going!.
@imyounick
@imyounick 3 жыл бұрын
Please tell me why Exporting individual functions is better than Wrapping all function in object and then exporting
@aditya-xt4it
@aditya-xt4it 3 жыл бұрын
thank you soo much I wasted almost 10 hours about this topic and finally you cleared my doubt thanks a lot
@samtheglamurai
@samtheglamurai Жыл бұрын
I'm in a coding bootcamp and was really hung up on this, then I found this video and it helped me understand sooooo much better! Thanks for your thorough explanation, it saved me!!! 😅 Totally had to subscribe!
@graemegibbings6121
@graemegibbings6121 Ай бұрын
Wow. Finally someone explains things in a way that makes sense. Thank you so much. Glad I found this video
@jjanchovi8568
@jjanchovi8568 4 жыл бұрын
you explain everything so well! Thank you sir !
@virender288
@virender288 5 ай бұрын
Thank you so much to makes topic understandable for beginner like me sir huge respect best wishes :))😇
@JayTheMachine
@JayTheMachine Жыл бұрын
Very Very Very Helpful (with capital V and capital H). Thanks!
@rolandovillcaarias5112
@rolandovillcaarias5112 3 жыл бұрын
Thank you for those clarifications. But still confused why you typed { add } instead of just add.
@itzblinkzy1728
@itzblinkzy1728 4 жыл бұрын
Great explanation sir, thank you so much.
@doriandoussain1528
@doriandoussain1528 2 жыл бұрын
Sometimes indian guys are hard to understand, appreciate the time your take for be clear and understandable, thx.
@jaleotech5918
@jaleotech5918 3 жыл бұрын
Bloody convoluted explanations. If you're looking to learn JS and node find someone else to learn it from. Utter nonsense.
@elvispontes4165
@elvispontes4165 Жыл бұрын
Thanks a lot. One question, why do you use var on your examples instead of const or let?
@theSwomry
@theSwomry 3 жыл бұрын
for someone who seems to be _really_ good at programming, you sure type like a 4th grader. (not hating lmao)
@vickycoool13
@vickycoool13 4 жыл бұрын
Seems add function in first.js is not working properly. When operatorsObj.add(10,20) is getting called It should return 30, but its returning 3 and it must be after Hello there, Koushik!. Please clarify me if I am not getting it properly.
@elroi6289
@elroi6289 2 жыл бұрын
But what if I have over 30 functions in the module??
@jagannathkv9942
@jagannathkv9942 3 жыл бұрын
can i use export default to export a function and us the import to use it in another file?
@nevinkuser9892
@nevinkuser9892 Жыл бұрын
The code at 10:40 looks beautiful. So clean!
@rouabahoussama
@rouabahoussama 4 жыл бұрын
in the add.js file the console.log(add(1,2)); is executing each time you call require("./add.js"); which is not what you are intended to do by calling it from first.js you call : // this is code from first.js add(1,2); // here you don't log the result to the console please be careful peace.
@sbszcc
@sbszcc 4 жыл бұрын
you're right, I made the same analisis, anyway is undeniable that it's an excellent course
@rakyatjelata3614
@rakyatjelata3614 2 жыл бұрын
About 1.2 is true?
@LORDFARQUAADIUS
@LORDFARQUAADIUS 3 жыл бұрын
Very clear, thank you!
@naseem5622
@naseem5622 Жыл бұрын
sir thanks a lot for this is the perfect explanation
@Jacketsmargiela
@Jacketsmargiela 2 жыл бұрын
you sir just earned yourself a subscriber
@thandolwenkosinzimande818
@thandolwenkosinzimande818 11 ай бұрын
Thank you for the great tutorial.
@srinidhikoundinya18
@srinidhikoundinya18 4 жыл бұрын
Sir Please Explain the difference between using require and import in javascript
@izeoguandrew5358
@izeoguandrew5358 2 жыл бұрын
Youre simply amazing
@vidhanchandra3698
@vidhanchandra3698 4 жыл бұрын
So whenever my manger says Dude why don't you upgrade yourself I visit JavaBrains and mission accomplished :D :D .. Kaushik Sir, something in AWS or GCP is the next thing which we all are expecting from you ..Hope we will get it soon... Thanks.
@smartguy3k
@smartguy3k 3 жыл бұрын
great video. Thanks.
@vivekberlia8582
@vivekberlia8582 4 жыл бұрын
Please explain es6 concepts also
@sreid70
@sreid70 4 жыл бұрын
I saw a post on StackOverflow that basically said this: module.exports = {}; var exports = module.exports; If you just imagine that is at the top of every module you make automatically, it becomes easy to see how the module system works. Great video, thanks.
@ZoomAnimationHere
@ZoomAnimationHere 2 жыл бұрын
Concepts are totally clear :)
@peterabiodunokusolubo1541
@peterabiodunokusolubo1541 2 жыл бұрын
You are simply the best
@jacobyako
@jacobyako 2 жыл бұрын
Hands down best JS and Node.JS understanding on KZbin. Others always say just show you the code, but he shows the details which helps people learn and encode in the brain not just memorize.
@nevinkuser9892
@nevinkuser9892 Жыл бұрын
Wow. I couldn't find this great of an explanation anywhere else on the entire internet. You did a great job! Thank you. 🙏
@codegate615
@codegate615 2 жыл бұрын
Javabrains has a gift for teaching. Only problem is he hasn't covered more coding topics!
@iqboss2008
@iqboss2008 4 жыл бұрын
Can you explain why you said exports.add is the recommended method over module.exports
@goksnarasi
@goksnarasi 3 жыл бұрын
Thanks Very much
@crs2236
@crs2236 4 жыл бұрын
Hai sir can u explain active directory and LDAP authentication spring boot can u explain real time example
@Medi0cr3-
@Medi0cr3- 2 жыл бұрын
nice job man, this clarified things I thought I was decent at, but helped immensely in my project.
@brunosastre1948
@brunosastre1948 2 жыл бұрын
Thank you very much for such a great and detailed explanation! :D
@SameeraSenarathna
@SameeraSenarathna 4 жыл бұрын
You are the best teacher 😊
@McRyach
@McRyach 2 жыл бұрын
require is not defined
@only_pps
@only_pps 4 жыл бұрын
Have been learning many of the core functions of java and JavaScript from java brains. All the uploaded content is best.
@vinayjangra1401
@vinayjangra1401 Жыл бұрын
what is a machine?
@drop9066
@drop9066 3 жыл бұрын
you sir, are god.
@namesurname4708
@namesurname4708 3 жыл бұрын
TY so much Bro ;)
@TomHermans
@TomHermans 2 жыл бұрын
This was really helpful to see beyond the various ways of notations and why syntax is used one way or the other. Thanks
@afiq980
@afiq980 Жыл бұрын
Thank you!
@Barnardrab
@Barnardrab 3 жыл бұрын
Thanks. You gave me what I require within the first 3 minutes.
@tienpham4903
@tienpham4903 3 жыл бұрын
like for you
@ecam90
@ecam90 4 жыл бұрын
This is excellent. And I love the purple theme. Subscribed.
@thedevfactor784
@thedevfactor784 4 жыл бұрын
Please make tutorials on express.js
@vinaykumarbudanurmath6927
@vinaykumarbudanurmath6927 4 жыл бұрын
Thank you
@TinyTreeTales
@TinyTreeTales 4 жыл бұрын
Thank you very much sir for the well explained tutorial on node. Waiting for the next concept...
@victorsoares5171
@victorsoares5171 3 жыл бұрын
thanks
@Roozbeh49463
@Roozbeh49463 3 жыл бұрын
one of the best tutorial i ever seen. its very simple explanation. thanks
@khimaanshu9
@khimaanshu9 4 жыл бұрын
Thank you for this wonderful tutorial. Please upload rest of the videos ASAP, so that we can utilize lockdown in learning Node JS.
@dishantkumawat7508
@dishantkumawat7508 4 жыл бұрын
please add more videos of node js as soon as possible im waiting for you to teach us
@dainspiration
@dainspiration 4 жыл бұрын
This was really helpful.. Thank you!!!!
@ArSri1555
@ArSri1555 3 жыл бұрын
Thanks a lot for explaining clearly.
@corsaronero5619
@corsaronero5619 4 жыл бұрын
chapeau sir, u nr.1, please create a series on nativescript, i guess i can learn just from you!! :D
@somystic100
@somystic100 3 жыл бұрын
Thank you for this lesson! Very helpful
@babinsapkota8269
@babinsapkota8269 3 жыл бұрын
Man you are a total life saver !!. God Bless You
@DeepakGupta-hj2dv
@DeepakGupta-hj2dv 4 жыл бұрын
How video dealy...Please everyday upload in one video sir...
@harshal543
@harshal543 4 жыл бұрын
Thank you Kaushik for this wonderful tutorial. I suggest you post the whole series as soon as possible. so we can utilize lockdown time to learn Nodejs.
@abhijitmohanty7818
@abhijitmohanty7818 4 жыл бұрын
What's your view on IT recruitment in upcoming days
@roshanjha5390
@roshanjha5390 4 жыл бұрын
i had a one question, we are calling add(10, 20) from first.js but it is still returning the value of add(1, 2) defined in add.js. would anybody please help me out with this, i did not understand.
@roshanjha5390
@roshanjha5390 4 жыл бұрын
i got it my mistake
@sanketsultan2348
@sanketsultan2348 4 жыл бұрын
sir waiting for more videos on node js
@glennadams7047
@glennadams7047 4 жыл бұрын
Best explanation!!!
@kamalhm-dev
@kamalhm-dev 4 жыл бұрын
will this also work on js?
@vickycoool13
@vickycoool13 4 жыл бұрын
Seems add function in first.js is not working properly. When operatorsObj.add(10,20) is getting called It should return 30, but its returning 3 and it must be after Hello there, Koushik!. Please clarify me if I am not getting it properly.
@harsimransingh5305
@harsimransingh5305 4 жыл бұрын
we are not printing returned value in case of operatorsObj.add(10,20) and 3 is printed because of console.log() in add.js
@sandeepsundaram5577
@sandeepsundaram5577 4 жыл бұрын
simple clear and crisp
@fratell
@fratell 4 жыл бұрын
Thanks
@DeepakGupta-hj2dv
@DeepakGupta-hj2dv 4 жыл бұрын
Outstanding explanation sir ...Thank you so much for change my life this series 😊
@ieatnoodls
@ieatnoodls 3 жыл бұрын
nice and detailed explanation, thanks
Require with node apis - Node.js Basics [10] - Java Brains
8:03
Java Brains
Рет қаралды 20 М.
Classes and module exports in javascript
14:29
Hitesh Choudhary
Рет қаралды 38 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 259 МЛН
The joker favorite#joker  #shorts
00:15
Untitled Joker
Рет қаралды 30 МЛН
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 52 МЛН
My Experience with JavaScript as a Java Developer
11:28
ForrestKnight
Рет қаралды 57 М.
How to Export and Require Modules in NodeJS
12:36
Steve Griffith - Prof3ssorSt3v3
Рет қаралды 55 М.
Why software development has become stressful
19:02
Java Brains
Рет қаралды 18 М.
Javascript Promises vs Async Await EXPLAINED (in 5 minutes)
5:50
Roberts Dev Talk
Рет қаралды 591 М.
How Node JS Works?
9:11
Telusko
Рет қаралды 205 М.
Node.js Tutorials - 15 - Module.Exports vs Exports
8:38
Codevolution
Рет қаралды 49 М.
Writing user input to file - Node.js Basics [11] - Java Brains
11:42
Node modules intro - Node.js Basics [08] - Java Brains
8:59
Java Brains
Рет қаралды 23 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 259 МЛН