JavaScript
  Home arrow JavaScript arrow Page 3 - The Power of Javascript: Basic Concepts
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

The Power of Javascript: Basic Concepts
By: Michael Youssef
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 21
    2005-07-05

    Table of Contents:
  • The Power of Javascript: Basic Concepts
  • Javascript Comments
  • Javascript Statements
  • Keywords
  • Identifiers
  • White Spaces and Case Sensitivity

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Power of Javascript: Basic Concepts - Javascript Statements


    (Page 3 of 6 )

    As you know, a script is executed line by line downward exactly as we read English. Take a look at the following English sentences:

    Bring a piece of paper.

    Bring a pen.

    Write "Hello Dear."

    When we read these sentences, we write them downward, or if they are all in the same line we will begin with the first one, then the second one, then the third and so on. A sentence in English has meaning; say "Bring me a piece of paper" to your friend, for instance, and he will give you a piece of paper. The sentence is terminated by the full stop symbol (.).

    The same rules apply to Javascript. The English sentences are called statements in Javascript, and they execute downward. A Javascript statement is terminated with a semicolon (;) (you don't have to put it in, but for now let's just say that it's a good practice to terminate each statement with it). A statement instructs the interpreter to do something, like this statement:

    var x = 2 + 1;

    This statement adds 2 and 1, then puts the result in a memory place called x. We will discuss all these concepts in detail so you don't have to worry about how you can create such statements. This is enough to know about Javascript statements for now. 

    A Fast Look at Variables

    To be able to continue with our discussion about the concepts in this article we must take a fast look at variables. The script statements (instructions) have to work on data; this is what programming is all about. We need a way to store data in the memory and operate on it.

    A variable is a block of memory that is used to store data. It is called a variable because the value that's stored inside it can be changed.

    Say that we have a memory location called x and we stored the value 243 in it. After a few statements in the script the value of x (which is 243) has been changed by a statement to the value 10, and after another three statements it has been changed to the value 567, and so on. So a variable is a memory location that we use to store data that we will operate on. What I mean by operate on is that we can add or multiply the value by another value, and perform may other operations on the value that we will learn about in the series. To declare that your script needs a memory location to store some data, we need to understand two important basic concepts in Javascript: keywords and identifiers.

    More JavaScript Articles
    More By Michael Youssef


     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek