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
Insights for Advanced Zooming and Panning in JavaScript Charts
How to open a car sharing service
Vue developer as a vital part of every software team
Vue.js developers: hire them, use them and get ahead of the competition
3 Reasons Why Java is so Popular
Migrate to Angular: why and how you should do it
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


Top view articles
Adding JavaScript to WordPress Effectively with JavaScript Localization feature
Top 10 Beautiful Christmas Countdown Timers
Top 10 Best JavaScript eBooks that Beginners should Learn
65 Free JavaScript Photo Gallery Solutions
16 Free Code Syntax Highlighters by Javascript For Better Programming
Best Free Linux Web Programming Editors
Top 50 Most Addictive and Popular Facebook mini games
More 30 Excellent JavaScript/AJAX based Photo Galleries to Boost your Sites
Top 10 Free Web Chat box Plug-ins and Add-ons
The Ultimate JavaScript Tutorial in Web Design


Free JavaScript Tutorials & Articles
at www.JavaScriptBank.com