should use them for (maybe the teacher didn't teach well XD). Do you have a solution for this? And are promises used a lot in node.js and are important ?
Promises make sense after you trip over callbacks. If you don't use callbacks in your code (meaning you don't do asynchronous stuff like read from filesystem or fetch resources over the network) then promises aren't really useful
Yeah learning promises is pretty much a MUST Also don't be hard on yourself since it might be the first time you've heard about this concept (the event loop and how it executes code etc...) Keep learning from different resources and practice it, that's how I understood it
It's mean promises aren't use lot in node.js ?
Yes, this is the first time I worked with it and it was hard for me to understand where it is used and what it is used for. Do you know a video or a special resource for learning promises that is good and easy?
They are, but they aren't a must just yet. But you should learn them, they make life sooo much easier
Oh thanks you :) can you suggest me a video for that ?
For just about every asynchronous task, you can use callbacks. But expect that to change as more stiff becomes promise based
Hmmm ... Let me rummage through my browser history, there's probably something there. I'm mostly a text person so most of my links are to reference materials like MDN and books
Maybe it will be difficult for me at first and I will be able to learn it over time
Yeah, it was that way for most of us. Promises were developed to solve a class of problems not everyone faces and especially not in the beginning
Have you any experience using JS for web development? Have you done anything in node?
Oh, I would be grateful if you could give me a tutorial in simple language. And of course, I'm sorry for bothering you 🙏
I remember this video helping me grasp the concept, but it was a long time ago and I'd been beating my head about it for a while https://youtu.be/2d7s3spWAzo
No, I'm currently learning JavaScript after that i will start node
This is a basic guide I used multiple times whenever I needed to remind myself https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises
Thank you very much, maybe this video can definitely help me ❤️❤️❤️
Maybe, and if not see what YouTube recommends after watching that
I will definitely read it. Thank you :))))
I also like w3schools when I want a quick tutorial (for more in depth, find a nice big boring book) https://www.w3schools.com/js/
Yes, w3school will probably help me, but the video you sent me made me happy the most, and I thank you again for your guidance 🙏❤️
You are welcome
Learn callbacks first. Promises are just a solution for the callback hell problem. Also known as the callback pyramid or pyramud of doom
They are used a lot. Also async/await (another way of handling async code) are used a lot. Makes the code cleaner
It's okay you will be better in future if you work with that
Hummm , What is the best video tutorial for callbacks?
No idea. I almost don't watch videos. I can explain it to you. The a callback function is a regular function that is passed as argument to other function. For example: const sayName = function ( name, do_something_with_name) { console.log( do_something_with_name(name) ); } const toUpperCase = name => name.toUpperCase(); const reverse = name => name.split('').reverse().join(''); sayName("manolo", toUpperCase); sayName("manolo", reverse); This pattern is very usefull to work with asyncronous code. For example to request multiple webpages at the same time . So you can make sure that your callback function is called after the data is fetched from the remote server. For example, is used a lot with fetch function.
Unfortunately it's been a long time since I've visited those resources, but just search through YouTube and watch a few of them and practice the code they're writing, you'll get the hang of it pretty fast
Thanks you for help I'm so glad for this JavaScript community and thanks you for helping me ❤️
Обсуждают сегодня