Professional Documents
Culture Documents
Textbook exercise-G6-M3
Textbook exercise-G6-M3
2. What is a variable?
JavaScript variables are containers for storing data values.
3. What is an identifier?
All JavaScript entities must be identified with unique names. These
unique names are called identifiers. Identifiers can be short names
(like x and y) or more descriptive names (age, sum etc.).
4. What is a statement?
a statement is a piece of code that the computer can execute.
JavaScript statements are composed of identifiers, operators,
expressions. keywords and comments.
2. What are identifiers and how are they different from variables?
Provide examples.
An identifier is a name given to an entity, which distinctly identifies
an entity in a program at the time of its execution. Variable is also
an identifier, its name uniquely identifies itself in a program. Here,
the fundamental difference between an identifier and a variable is
that an identifier is a “name given to an entity” whereas in a
program a variable is a “name given to a memory location” that is
used to hold a value, which may get modified during program
execution. All variables are identifiers. But not all identifiers are
variables. For example, the name of a function is an identifier but
not a variable.
var cyberSquare, cybersquare ;
cyberSquare = “programming world”;
cybersquare = “cyberkid”;
3. What are JavaScript statements? Explain with examples.
A computer program is a sequence of “instructions” to be executed
by a computer. In a programming language, these instructions are
called statements. Alternatively, a statement is a piece of code that
the computer can execute. JavaScript statements are composed of
identifiers, operators, expressions. keywords and comments.
Eg:
var a = 625;
var b = 750;
var c= 2*a+b;