JavaScript Statements

      No Comments on JavaScript Statements

In a programming language any instructions to be executed are called statements.. JavaScript statements are separated by semicolons.
Example:

var x=5;
var y=10;
var z=x+y;
var txt="Hello world";

JavaScript statements are composed of:Values, Operators, Expressions, Keywords, and Comments.

  • JavaScript value can be fixed or variable. The fixed values are called literals. The most common example of literals are numbers like 10 or 100.59 or text value like “Hello world” or “John”. Variables are used to store data values. JavaScript uses the var keyword to declare a variable and equal to sing the assign value to that variable.
    var variable_name = variable_value;.
    Example var x=5;
  • JavaScript support various operators-
    1. Assignment operators (=) to assign values to variables.
    2. Arithmetic operators ( + * – /) to compute values.
  • JavaScript Expression is a combination of values, variables, and operators, which computes to a value. The computation is called an evaluation.
    For example, 5 * 10 evaluates to 50.
    Expressions can also have variables.
    For example, 5*x.
  • JavaScript keywords are used ti identify actions.
    For example, var
    keyword tells the variable declaration.
  • JavaScript Comments are the part of the code that is not executed.Code after double slashes // or between /* and */ is treated as a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *