Training Lexical Structure and Statements

This free HTML JavaScript tutorial provides some basic JavaScript concepts for programming newbies. In this post, you will train some categories of JavaScript statements, JavaScript blocks and Group of JavaScript statements, some tips on declaring a JavaScript Statement.


Sampled by © JavaScriptBank.com

A JavaScript statement is a command to a web browser to perform specific task define (program written) by the user. JavaScript Statements are written with the set of elementary rules that specifies how to write JavaScript programs. A JavaScript program is a set of one or more statements. A statement will have internal components like Variables, Literals, Identifier, reserved keywords, Comments, conditional statement, Arrays, Functions, Objects, Classes etc

JavaScript is case sensitive, in the most of cases JavaScript Statements terminated with a semicolon(;) or with Returns(Enter or line-break). Even though semicolon is optional, JavaScript Statements terminated with a semicolon(;) is the best practice of JavaScript programming.

var txtName="I love JavaScript";
var intNum=10

semicolons allows us to group multiple statements on one line.

x = x + 1;  y = 20;  z = x+y;

As the semicolon is optional, we can represent above statements separated with a line-break.

x = x + 1
y = 20
z = x+y

Categories of JavaScript Statements

Depending on the task a statement perform, they are categories as:

  • Conditional Statements
  • Loop Statements
  • Object Manipulation Statements
  • Comment Statements
  • Exception Handling Statements

JavaScript Blocks - Group of JavaScript Statements

JavaScript statements can be grouped together in blocks. Curly braces ({ }) are used to group a list of statements together in blocks. JavaScript block helps to execute sequence of statements together to perform a specific task. JavaScript block are the integral part of the function and conditional loops.

<script type="text/javascript">
for (x=0; x < 10; x++)
{
  document.write("x="+ x +"<br>");
}
</script>

Some Tips on declaring a JavaScript Statement

  • JavaScript programs are written using the Unicode character set.
  • JavaScript is a case-sensitive language so take care while defining and using variables, function names.
  • Do not use reserved keywords as variables, function names.
  • JavaScript ignores spaces, tabs, and newlines that appear between tokens in programs so indent your programs as per your consistency.
  • Omitting semicolons is not a good programming practice; you should get in the habit of using them.

Language
Translate this page to English Translate this page to French Translate this page to Vietnamese

Recent articles
The Possible Working Methods of Python Ideology
JavaScript Research Paper: 6 Writing Tips to Craft a Masterpiece
Learning How to Make Use of New Marketing Trends
5 Important Elements of an E-commerce Website
How To Create A Successful Prototype For Your PCB
WordPress Landing Page Conversion Essentials to Convert More
4 Development Hacks To Make Your Website Launch A Success
Why Data Recovery Software and Services are Important
Why Engineers Specializing in DevOps Are the Wave of the Future
The Ultimate Checklist for HTTP to HTTPS Migration


Top view articles
65 Free JavaScript Photo Gallery Solutions
Top 10 Beautiful Christmas Countdown Timers
Best Free Linux Web Programming Editors
Top 50 Most Addictive and Popular Facebook mini games
Top 10 Free Web Chat box Plug-ins and Add-ons
50+ Beautiful Resources of HTML Form using CSS and JavaScript
Top 10 Best JavaScript eBooks that Beginners should Learn
The Ultimate JavaScript Tutorial in Web Design
HTML5 Web Workers Multithreading in JavaScript
Learn more about JavaScript Inheritance with Tiny JavaScript Example Codes


Free JavaScript Tutorials & Articles
at www.JavaScriptBank.com