If I could go back in time, I would tell myself this sentence: "Ignore the compatibility of DOM and BOM when I first learned JavaScript"
My situation when I first learned JavaScript
When I first learned JavaScript, the biggest headache was browser compatibility. The code that works well under Firefox cannot be displayed in IE, or the code that can be displayed normally in IE reports an error in Firefox.
The responsibilities of front-end development engineers include cross-browser development. So I spent time learning browser compatibility knowledge when I didn’t understand the JS language itself, which would make it more difficult to learn JS. However, code that is not compatible with mainstream browsers cannot be used in actual projects.
The compatibility issue between DOM and BOM once stalled my JavaScript learning. The language understanding is not enough, and the code can only run in specific browsers.
My suggestion
If you are new to JavaScript and are in the same situation as me, I suggest you: ignore the compatibility of DOM and BOM when you first learn JavaScript. Spend more time understanding the language itself (ECMAScript). Only write code in specific browsers (Chrome/Firefox/Safari), and use mature JavaScript frameworks (jQuery, etc.) for actual work. Don’t worry, few companies will let JS novices use native JS for front-end development.
What are the benefits of ignoring compatibility issues in the early stage of learning JS
Reduce learning difficulty
Reduce frustration
Spend more time learning ECMAScript
When will you learn JS cross-browser development knowledge
And when will the browser compatibility issue be solved?
When you are proficient in using JavaScript frameworks to write reusable code (jQuery plug-in or front-end control), or when you are ready to develop a JavaScript framework yourself.
Some other JavaScript beginners suggest
Never take the Definitive Guide to JavaScript as an introductory book
You should use JavaScript Advanced Programming (Third Edition) as an introductory book Books
Must understand value-passing, value-passing, and scope knowledge
Debugging tools must be understood and used multiple times, and learn to catch errors yourself. (chrome developer tool/Firebug)
Be patient and dig deeper into every knowledge point to learn more easily.
The above is some of my sharing. I hope it can help you who are new to JavaScript. If you feel there is any misleading, please point it out immediately.