Lexical
Structure of a JavaScript Program
The
lexical structure of a programming language is the set of elementary rules that
specifies how to write programs in that language. It is the lowest-level syntax
of a language. The Lexical structure specifies variable names, the delimiter
characters for comments, and how one program statement is separated from the
next.
•
Though
JavaScript is a case-sensitive language. It is good programming practice to
type the command in lowercase.
•
JavaScript
ignores spaces that appear between tokens (identifiers, operators, punctuator,
constants and keywords) in programs.
•
JavaScript supports two styles of comments. Any text follow
a “//” and the end of a line is treated as a single line comment and is ignored
by JavaScript. Any text between the characters “ /* */” is also treated as a
multiline comment.
•
JavaScript
uses the semicolon (;) to separate statements. Many JavaScript programmers use
semicolons to explicitly mark the ends of statements.
•
A
literal is a data value for variable that appears directly in a program.
•
An
identifier is simply a name. In JavaScript, identifiers are used to name
variables, functions and to provide labels for certain loops in JavaScript
code.
•
In
JavaScript certain keywords are used
as reserved words, These words cannot used as identifiers in the programs
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.