Imagine there is a framework/language you want to learn and you have heard about a good book that explains very well the concepts/details. Also, there is a good YouTube/Udemy course that your colleges have recommended and you can take it in a couple of hours. Which is your first choice?
I believe everyone learns in different ways. I consider myself as a hands-on leaner, I prefer watching videos than reading a book because quite often go straight to the point and you can follow easily.
However, through the years, I have found out that (in my opinion) YouTube videos is a good start, because nowadays everybody can upload a video about programming concepts or frameworks. Also, I have noticed bad coding practices or design patterns on videos that I wouldn't definitely do in my projects, maybe it's because they want to teach an specific concept and forget about best practices or write clean code. I think this is harmful for new programmers.
On the other hand, books are to formal; Preface, Introduction, concept definitions and so on. However books explain with details about concepts and techniques, you can have a big picture about what you are learning and frequently they follow good programming practices, because they are written by professionals (PhDs, professors, researchers, experienced programmers).
So, my opinion is that YouTube videos is a good start, you can learn while doing and even ask if you got questions, but you shouldn't consider this as a I'm done, you know only the basics about something. If you really want to learn in depth about something I'd recommend reading a book, there are a lot great books about everything.
What do you think about this? What about Hackathons? College? In person courses? Let's talk about in the comments.