Code Structure Of JavaScript | Fundamentals of JavaScript Programming Language | Part — 2
Code Structure Of JavaScript (js)
Here is a list of some of the fundamentals of JavaScript that we discussed about in previous tutorial:
- JavaScript Statements
- JavaScript Semicolons
- JavaScript Whitespaces
- JavaScript Parenthesis
- JavaScript Identifiers
- JavaScript Indentation
- JavaScript Reserved Keyword
- JavaScript Case Sensitive
- JavaScript Comments
- JavaScript Camel Case
If you didn’t read one of these, click here to read previous article of part-1 .
Here is a list of some of the fundamentals of JavaScript that you will learn about in this tutorial of Part — 2 :
- JavaScript Syntax
- JavaScript Values
- JavaScript Literals
- JavaScript Expression
- JavaScript Variables
- JavaScript Operators
- JavaScript Character Set
- JavaScript Data Types
- JavaScript Code Blocks
- JavaScript Line Length and Line Breaks
11. Syntax in JavaScript (js):
JavaScript syntax is the set of rules, how JavaScript programs are constructed.
12. Values in JavaScript (js):
JavaScript Literals are constant values which can be a numeric, string, floating-point value, a boolean value or even an object that can be assigned to the variables that are called literals or constants .
Types of literals in javascript (js) :
There are four types of literals :-
1. String Literals: String literals are always surrounded by single quotes (‘) or double quotes (“)
let tutorial = 'Best JavaScript Tutorials'; let tutorial = "Best JavaScript Tutorials";
14. Expression in JavaScript (js):
An expression is any valid unit of code which is a combination of values, variables, and operators that computes to a value. The computation is called an evaluation.
For example, 5 * 10 evaluates to 50:
15. Variables in JavaScript (js):
A variable is a container (storage area) which is used to store data values and it is also known as named containers.
- JavaScript uses the keywords var, let and const to declare variables.
- An equal sign is used to assign values to variables.
In this example, personAge is defined as a variable. Then, personAge is assigned (given) the value 30
16. Operators in JavaScript (js):
Here, + is the arithmetic operator and = is the assignment operator. There are following types of operators in JavaScript:
17. Character Set in JavaScript (js):
JavaScript programs are written using the Unicode character set. Unicode is a superset of ASCII and Latin-1 and supports virtually every written language currently used on the planet. ECMAScript 3 requires JavaScript implementations to support Unicode version 2.1 or later, and ECMAScript 5 requires implementations to support Unicode 3 or later.
18. Data Types in JavaScript (js):
A data type is a classification of data to hold different types of values which tells the compiler or interpreter how the programmer intends to use the data.
JavaScript is a dynamic type language, means you don’t need to specify type of the variable because it is dynamically used by JavaScript engine. You need to use var here to specify the data type. It can hold any type of values such as numbers, strings etc.
19. Code Blocks in JavaScript (js):
A code block simply consists of grouped statements with curly braces { } .
JavaScript statements can be grouped together in code blocks, inside curly brackets {…}.
The purpose of code blocks is to define statements to be executed together.
20. Line Length and Line Breaks in JavaScript (js):
For best readability, programmers often like to avoid code lines longer than 80 characters.
If a JavaScript statement does not fit on one line, the best place to break it is after an operator:
document.getElementById("welcome").innerHTML =
"Hello JavaScript Programmers!";
Originally published at https://www.codeshikhi.com.