Page 134 - CITS - Computer Software Application -TT
P. 134

COMPUTER SOFTWARE APPLICATION - CITS




           JavaScript Comments
           Not all JavaScript statements are “executed”.
           Code after double slashes // or between /* and */ is treated as a comment.
           Comments are ignored, and will not be executed:
           let x = 5;   // I will be executed
           // x = 6;   I will NOT be executed

           You will learn more about comments in a later chapter.
           JavaScript Identifiers / Names
           Identifiers are JavaScript names.
           Identifiers are used to name variables and keywords, and functions.

           The rules for legal names are the same in most programming languages.
           A JavaScript name must begin with:
           •  A letter (A-Z or a-z)
           •  A dollar sign ($)
           •  Or an underscore (_)

           Subsequent characters may be letters, digits, underscores, or dollar signs.
           Note
           Numbers are not allowed as the first character in names.
           This way JavaScript can easily distinguish identifiers from numbers.
           JavaScript is Case Sensitive

           All JavaScript identifiers are case sensitive.
           The variables lastName and lastname, are two different variables:
           let lastname, lastName;
           lastName = “Doe”;
           lastname = “Peterson”;
           JavaScript does not interpret LET or Let as the keyword let.
           JavaScript and Camel Case
           Historically, programmers have used different ways of joining multiple words into one variable name:
           Hyphens:
           first-name, last-name, master-card, inter-city.
           Hyphens are not allowed in JavaScript. They are reserved for subtractions.
           Underscore:
           first_name, last_name, master_card, inter_city.
           Upper Camel Case (Pascal Case):
           FirstName, LastName, MasterCard, InterCity.
           Lower Camel Case:
           JavaScript programmers tend to use camel case that starts with a lowercase letter:
           firstName, lastName, masterCard, interCity.
           JavaScript Character Set

           JavaScript uses the Unicode character set.
           Unicode covers (almost) all the characters, punctuations, and symbols in the world.


                                                           121

                             CITS : IT&ITES - Computer  Software Application - Lesson 37 - 46
   129   130   131   132   133   134   135   136   137   138   139