Javascript Statement

In the previous tutorial, we have seen how to create a Javascript file. While writing Javascript source code into a source file, we actually write a set of Javascript statement. Every programming language has statements like Javascript.

Statements are nothing but it indicates every individual line or a couple of lines (code block) of programming instruction in a program source file. Statements are made with variable, expression, value, logic, function, etc.

The statement is an important concept of any programming language. It helps to understand the basic syntax of a programming language. Statements also express the coding conventions of a programming language.

Javascript Statement

Javascript statements may refers to a single line or a couple of lines of Javascript code within a javascript file (.js extension file).

One or many Javascript statements make a complete javascript file and all the statements are called Javascript code or Javascript source file.

Javascript Statement is important because Javascript Interpreter executes the code statement by statement as written in the source file. So, writing statement gradually is important for proper execution.


var x = 6, y = 6, z; //statement-1
var z = x + y; //statement-2
console.log(z); //statement-3

In the above code, every single line is a statement. And they are composed with, variable, keywords, arithmetic, command, etc.

Javascript Code Block Statement

Every single line in Javascript we may call as a statement. But sometimes multiple lines also can be a single statement.

In Javascript, this happens when you write a function and make a code block with curly braces, function myFunction() { //multiple line code }


function myFunction() {
  console.log("Hello, Alex!");
  console.log("Welcome to PrograCoding Self-learners family");
//the entire function is considered as a statement

Here we can feel why the concept of Statement is important. We know Javascript execute statement by statement. So if we want to execute a code block or statement earlier than one. Then we have to maintain the statement sequence.

Concept of statements also makes a clear understanding of Javascript syntax and coding conventions that helps the beginners Javascript learners to understand codes easily.

« Previous Next »

Posted in