Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

04 Syntax


JavaScript is case - sensitive.  

Like HTMl, JavaScript ignores spaces and line breaks.  Statements
can be split over multiple lines.

If a single JavaScript statement is on a single line, the line does not have
to end in a semicolon.  But it is considered good practice to always use
the semicolon.

Semicolons are used as a delimeter between multiple JavaScript statements
on a single line.  

A JavaScript program can supply a value using the return statement :

return true   //the program assigns a value to return to end a JavaScript
return false
return 25

JavaScript uses the curly brace pair, { } , to indicate blocks of code, such as
the code in a function .  Functions are written as :

function MyFunction (arg1, arg2, arg3)
   { Code Block }

When calling functions, the parentheses are required, even if there are
no arguments.

// comments can go behind two forward slashes

<!-- comments can also go behind the standard HTML tag (the second --> tag is not required)

/*
Or, a block of comments go between the pair of tags that surrounds this comment
*/