For the past few months, I have been struggling with trying to learn how to program in Javascript, one of the easiest languages one can learn (besides C, I suppose). I know to program in PHP pretty well, I got the whole concept down, and I’ve made plenty of sites to say that I’m experienced. I can work with MySQL, and I can do plenty of other things. However, Javascript has been giving me a headache, that is, until recently.

I tried to work through the language the same way I did with PHP. I watched a few in-depth videos, I tried to do some tutorials on good-tutorials, etc etc. But that did not work. However, I found a great way to get started with the language. I call this the “crash course method”.

Crash Course Method

Here is a summary of my crash-course method:

  1. go on a tutorial site, one that goes from the beginning to the end with Javascript, such as w3schools.
  2. look at the topics and write them down real quick like so ( – statements, – comments, – variables)
  3. for each topic, make a little program to demonstrate the topic, here is an example for  a for loop and comments:
    <html>
    <body>
    <script type="text/javascript">
    <!--
    	document.write("Start for loop" + "<br />");
    // single line comment
    	for (i = 0; i <=5; i++)
    	{
    	document.write(i + "<br />");
    	}
    /*
    block comment
    */
    	document.write ("For loop ends");
    //-->
    </script>
    </body>
    </html>

  4. Don’t focus on the details of javascript, or the tutorials, each programming language works almost the same way (variables, loops, functions etc) so, simply see how javascript works and relate it to your language. For example, in PHP I used the echo function to print out text, javascript uses document.write() with the text between the parenthesis. In PHP, each variable has a dollar sign in front of it, in javascript, that is not the case. Do print out a variable, simply don’t use quotation marks. Make notes of these details, that’ll come in handy
  5. Have fun! Make little programs, pointless programs that could be made without the use of javascript. Simply, get used to writing the code, don’t find a way around it, tackle the project with javascript

The idea of a crash-course is not to focus on the details, and simply write code as much as possible. That helps the most, I found that out with PHP, and I’m starting to find this out with javascript as well. 

    Also, note that all programming languages work on a similar concept. Just because it looks unfamiliar, does not mean it does not follow the standard principles you’re used to.

    Share and Enjoy:
    • Print
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • LinkedIn
    • Reddit
    • Tumblr
    • Twitter
    • email
    • Slashdot
    • StumbleUpon