Back in the 2000's, before the invention of YouTube, people used to learn new programming languages using books and manuals. While books may be a good way to learn things in general, they are not the most effective when it comes to learning a programming language.
First of all, books are not free. It costs money to print a book and physically get it to you. You may argue that online resources like courses are not always free and you are right. Websites like Udemy offer lot's of courses for learning programming languages and they are mostly paid. But there are a lot of free resources on the internet, like w3schools.com and, of course, YouTube.
Something else to consider, is that when using online resources, you can code along. With a book, you have to clear space on your desk and flip the pages aswell. While this my not be an issue for most people, it is still more convenient to use a digital resource.
An important thing to point out, is that websites like w3schools.com often have live previews so you can see what a given block of code does. This helps you to visualize what the given code does and also play around with it. Books can not do this, for obvious reasons.
So next time you want to learn a new programming language, the browser is the place to go :D
Thank you for your attention.