0% found this document useful (0 votes)
6 views

SUMMARY OF JAVASCRIPT PROGRAMMING COMBINE

Chapter One of JavaScript Programming introduces JavaScript as a dynamic programming language that enhances web pages with interactivity and behavior, contrasting it with HTML and CSS. It covers fundamental concepts such as variables, decision-making with if/else statements, loops, and basic operations, along with examples of JavaScript code. Additionally, it discusses data types, operators, and the importance of values in JavaScript, including special numbers and string manipulation.

Uploaded by

okereebube87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

SUMMARY OF JAVASCRIPT PROGRAMMING COMBINE

Chapter One of JavaScript Programming introduces JavaScript as a dynamic programming language that enhances web pages with interactivity and behavior, contrasting it with HTML and CSS. It covers fundamental concepts such as variables, decision-making with if/else statements, loops, and basic operations, along with examples of JavaScript code. Additionally, it discusses data types, operators, and the importance of values in JavaScript, including special numbers and string manipulation.

Uploaded by

okereebube87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

SUMMARY OF JAVASCRIPT PROGRAMMING CHAPTER ONE

JavaScript is a programming language that gives your webpage


functionality and dynamics. JS help you add behavior, draw graphics
and some other interesting thing that would make your webpage fun
and interactive.
JavaScript behaves in a very unique way that can make webpage
interesting because unlike HTML which just helps us to create
paragraphs, add borders and title to our webpage and CSS which helps
add color and some other beautification factors, JavaScript lets you
create behavior and add programming to your webpage.
Writing, creating and loading are the three methods to write a
JavaScript.
The tag <script> is used to add dynamic behavior into our webpage, for
example:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My First JavaScript</title>
</head>
<body>
<script>
var word = "bottles";
var count = 99;
while (count > 0) {
console.log(count + " " + word + " of beer on the wall");
console.log(count + " " + word + " of beer,");
console.log("Take one down, pass it around,");
count = count - 1;
if (count > 0) {
console.log(count + " " + word + " of beer on the wall.");
} else {
console.log("No more " + word + " of beer on the wall.");
}
}
</script>
</body>
</html>
The element scr is used to load in the JavaScript code.
In HTML you usually markup text to give it structure, in CSS the set of
rules that is written to select and specify a set of style for the element
but in JavaScript the written statement specifies small part of
computation and together all the element creates the behavior.
For instance :
var age = 25;

var name = "Owen";

if (age > 14) { alert("Sorry this page is for kids only!");

} else { alert("Welcome " + name + "!");

 Var=variable : declares a variable name and a value for it


 Alert: is used to pop up a notification.
DECISI0N MAKING IN JAVASCRIPT: if/else are used so the developer
can string as much as he or she desires and also helps if all your
conditional fails.
e.g.
if (scoops >=5){
alert (“it faster”);
} else if (scoops ==3) {
Alert (“food is running low”);
Note:<,>,== are all conditional statement.
BOOLEAN EXPRESSION: Are true or false.

LOOP: This is a tool used to repeat a set of instructions.


TYPES OF LOOP
For: loops through a block of code a number of times.
While: is used to repeat an activity until a condition is met.
Do: is set to run until a certain data arrives.
Note: there are still other types of loop like forIn, foreach etc.
BASIC KNOWNLEGE
document.write: used to insert text and little HTML into a document.
console.log: used for simple debugging.
Alert: used to deliver a short message.
Document object model: used to control a webpage.
JAVASCRIPT WAS CREATED IN 1995 BY A BROWSER CALLED
NETSCAPE…

Eloquent Java
script (summary)
Values, Types and operators
All data in the computer is stored as long sequences of bits and thus its
fundamental.

Bits
Bits are any two valued things usually described as ones and zeros they take
forms in the computers such as high or low electrical charge strong or weak signals.

Values
Modern computer have large amount of bits in order to work with them, we
must separate them to chunks that represents parts of information. And in
JavaScript those chunks are called values hold different thing e.g.;
 Numbers
 Plain text
 Functions
Numbers
JavaScript uses a fixed number of bits, 64 of then to store a single number
value.
The number of different numbers that can be stored are limited.

Arithmetic
Arithmetic operations in java script include addition(+), subtraction(-),
multiplication(*) and division(/) this operators take two number values and produce
a new number.
When operators appear together with a parenthesis the sequence they are
applied is determined by the progression of the operators
There is one more operator (%) it is used to represent the remainder it is
referred to as modulo.

Special Numbers
Special numbers in JavaScript include;
 Infinity: this represents mathematical infinity it occurs when a number
exceed the longest possible value.

 -Infinity: this is the negative overflow.

 Nan: This represents a value that is not a legal number.

There are other special numbers in JavaScript like positive and negative zero,
biglint. But this are the main three.

Strings
String is a data type in JavaScript they are used to represent text they are
written by enclosing their content in quotes e.g., Single quotes, Double quotes and
backlits (Usually called template literals) to mark string.

Newline

The character when you pressed enter can be included only when the string
is quoted with a back-slash (\). backtics can also be used to embed other values.
.
Strings to have modeled as a series of bits to be able to exist inside the
computer. JavaScript does this using Unicode standard. Basically, every character in
a string can be represented as a sequence of numbers.
Arithmetic operators can not be used with string except for the (+) operator
which is used to combine strings together this called concatenation.

Unary Operators
Operators that use two values are called binary operators while those that
take one are called unary operators. There is also ternary operators which operate
on three values.

Boolean values
This values include TRUE and FALSE they also used for comparison

Binary operators
 (<) is less than
 (>) is greater than
 (>=) greater than or equals to
 (<=) less than or equals to

Logical operators
This are operator that can be applied to Boolean values. logical operators in
JavaScript include; “and”, “or” and “not”.
The “&&” operator represent the logic and its result is true only if both values
given to it are true.
The “||” operator denotes logical “or” it provides true if either of the values
given its true.
The “Not ” operator is written as an exclamation mark “!” it is a unary
operator that flips the value given to it as in true==false, false==true.

Empty Values
These values include “Null” and “undefined” they are used to identify values
that don’t carry information.
Automatic type conversion
When an operator to the “wrong” type of value, JavaScript will quietly convert
the value to the type it needs, using a set of rules that aren’t what you would
expect this is called “type coercion” when you don’t want a type conversion to
happen there are two other operators you can use “===” to check if the value is
precisely equals to the other value and “!==”to check if the value is not precisely
equals to the other.

Short circuiting of logical operators


we can use this functionality as a way to fall back on a default value if you have that
might empty you can put “||” after it instead the “&&” is similar but the other way
around

You might also like