What is the best way to learn JavaScript?

JavaScript

Asked on October 2, 2021 in Website.
Add Comment
  • 1 Answer(s)

    There are three different approaches that works for me when learning a new programming language.

    The first method is to look at examples of code in books or on websites. This is good because you get snippets of code to try out, but it doesn’t always provide an explanation of how each part works. You can then experiment with modifying bits of the example code to see what effect it has on the rest of the program. This is a nice way to learn one specific thing at a time without having to switch between many pages and files to figure out how everything fits together as a whole.

    You can also read books about JavaScript, but this doesn’t let you experiment with the code to see what happens. For some books, though, it is helpful to read a chapter or section and then try out what you learned in an online program editor that lets you type the code and see the output without having to run a program. Most of these types of editors also let you add in your own code snippets for future reference if you think of a way to do something later on. I feel like I learn more by actually typing out examples than just reading about them because when typing I am forced to get the syntax correct otherwise the interpreter will give me an error message.

    The second method is using tutorials that show how to configure tools such as text editors, browser developer tools, and web servers. This lets you write code to create HTML pages that load JavaScript files for testing. I like this method because you can quickly see your changes without having to make a whole new build of the program every time you want to test one small change.

    You could also use tutorials that show how to set up an integrated development environment (IDE) like NetBeans with the correct plug-ins, or install node.js and then download different versions of the required JavaScript file packages into them. Then you would be able to execute programs in real time as opposed to just running it once after building your program into an executable file like most IDE’s require. Unfortunately, not all tutorial authors do this for their readers so some tutorials can be more difficult to follow along with than others.

    The third method is using the debugger that usually comes with your browser’s JavaScript console. If you define a function and call it right away, then this will cause an error message under most circumstances because you haven’t defined what the function does yet so the interpreter doesn’t know how to carry out its task. You can use breakpoints in most browsers’ JavaScript consoles to stop where you want execution to halt before a function gets called so that you can check values of variables at specific points in your program as it runs. This let’s you see if certain parts of your code are causing errors by stopping at various points throughout the execution of your program and looking at things from various angles.

    The first two methods are good to use by themselves, but the third method is best used in combination with one of the other two. By using a combination of all three, you can learn any programming language much faster and understand it better than if you only use one or two methods on their own.

    Answered on October 2, 2021.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.