Professional Documents
Culture Documents
Ilias ahmed
Java ocjp
Chapter 1
Comments are ignored by the program, but make your program easier to read
and understand.
Primitive types are the basic building blocks of a program.
Primitive types in JavaScript include strings, numbers and Booleans.
Composite data types are structured collections of primitive data types.
Composite data types in JavaScript include arrays and objects.
Variables point to values stored in memory and are declared using
the const , let or var keywords.
Values are assigned to variables using the = operator.
The value of any variables declared using const can’t be changed.
You can reassign values to variables declared using let or var .
Alert, prompt and confirm boxes can be used to add some interaction between a
web page and the user.
Chapter 3
Strings are collections of characters that are used to show blocks of text in
JavaScript.
Special values can beescapedby placing a backslash ( \ ) in front of them.
Strings have various properties and methods that provide information about
them.
The length property tells us how many characters there are in a string.
Strings can beconcatenated(joined together) using the + operator.
Template literals are like superpowered strings, allowing JavaScript code to be
inserted into a string.
Chapter 4
chapter 5
Programming languages use a variety of different data structures to store values, but
one of the most common is an array.
In this chapter, we’ll be covering the following:
creating arrays
adding values to arrays
removing values from arrays
the spread operator
multi-dimensional arrays
Chapter 6
A loop is a block of code that runs over and over again until a certain condition is
met.
An infinite loop is a loop that never stops, as it’s impossible to meet the condition
for breaking out of the loop.
A while loop will continue to run as long as a particular condition is true.
A do–while loop will also run while a condition is true, but the condition comes at
the end, rather than the beginning of the loop.
A for loop sets the initial value, a condition for stopping, and increment at the
start, and then runs a block of code until the condition is met. After every loop, the
increment instruction is carried out.
Nested loops can be formed by running a loop within another loop. The inner
loop runs all the way through foreverypass of the outer loop.