Youโve built two simple componentsโan off-canvas menu and a modal windowโso far. Itโs a great start! What do you think? JavaScript isnโt that tough, eh? :)
Before continuing, letโs take a pause and examine two important lessons.
Lesson 1: You need to know HTML and CSS to use JavaScript properly
HTML and CSS skills are essential. If you donโt know HTML and CSS, nothing will come to your mind, because you need to write HTML and CSS before you write JavaScript.
If youโre weak in CSS, you might want to spend another 1/2 hour everyday to learn CSS. When you can build anything you see with CSS (and when you know what you canโt do with CSS), youโll know when and how to use JavaScript.
But donโt worry if you are weak in CSS, at least not for the duration of this course. I will show you the CSS you need to build the 20 components.
Should I stop learning JavaScript and start learning CSS instead?
Nope. Not now. Focus on JavaScript since youโre here.
If you learn something halfway and stop, you wouldnโt internalize whatโs important, which means to say youโll forget it if you donโt use it for a while.
You donโt want to forget JavaScript, right?
Besides, youโll learn the necessary CSS skills to build components in this course. Once youโre done learning JavaScript, you can work on your CSS again.
The best way to learn CSS
If you want to learn CSS, the best way is to create things. Pick anything and try to make it.
Just for your eyes only, I intend to make a CSS course to help you master CSS in 100 days after Iโm done writing Learn JavaScript. You can pick up that course to supersede your CSS learning.
(Please please please donโt spread this publicly. I donโt want you to tell anyone yet because I havenโt made a public commitment to this course. I want to focus on Learn JavaScript right now).
Lesson 2: Write your HTML and CSS first before JavaScript
You give yourself a chance to see how a component works best if you write HTML and CSS first. You can mock (or fake) JavaScript functionality (like adding is-open class) manually without writing a single line of JavaScript.
Once youโre done with mocking, adding JavaScript becomes an easy processโyou know what to change, you know where to change it.
Always write HTML and CSS before JavaScript.
Lesson 3: Minimize changes
Introduce minimal JavaScript changes. Try to stick to one, at most two class changes if you can.
Welcome! Unfortunately, you donโt have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson