JAVASCRIPT
JavaScript has 8 Datatypes
1. String
2. Number
3. Bigint
4. Boolean
5. Undefined
6. Null
7. Symbol
8. Object
[Link]
JAVASCRIPT
JavaScript Events
1. onclick
2. onchange
3. onkeydown
4. onload
5. onmouseover
6. onmouseout
7. onmousedown
8. onmouseup
9. onmousemove
[Link]
JAVASCRIPT
JavaScript Display Possibilities
Writing into an HTML element, using innerHTML
Writing into the HTML output using [Link]()
Writing into an alert box, using [Link]()
Writing into the browser console, using [Link]().
3 Ways to Declare a JavaScript Variable:
Using va
Using le
Using const
[Link]
JAVASCRIPT
JavaScript Operators
Arithmetic Operator
Assignment Operator
Comparison Operator
Logical Operator
Conditional Operator
Type Operators
JavaScript Comparison Operators
== equal to
== equal value and equal type
!= not equal
!== not equal value or not equal type
[Link]
JAVASCRIPT
JavaScript Comparison Operators
> greater than
< less than
>= greater than or equal to
<= less than or equal to
? ternary operator
JavaScript Logical Operators
&& logical and
|| logical or
! logical not
[Link]
JAVASCRIPT
JavaScript Type Operators
typeof Returns the type of a variable
instanceof Returns true if an object is an instance
of an object type
JavaScript Statements
let x, y, z; // Statement 1
x = 15; // Statement 2
y = 16; // Statement 3
z = x + y; // Statement 4
[Link]
JAVASCRIPT
JavaScript Declare
let a, b, c; // Declare 3 variables
a = 15; // Assign the value 5 to a
b = 16; // Assign the value 6 to b
c = a + b; // Assign the sum of a and b to c
When separated by semicolons, multiple statements
on one line are allowed:
a = 5; b = 6; c = a + b;
JavaScript Syntax
// How to create variables : var x;let y;
// How to use variables : x = 5;y = 6;
let z = x + y;
[Link]
JAVASCRIPT
JavaScript Strings
JavaScript strings are for storing and manipulating text.
Example
let text = "Pushpendra";
[Link](text)
String Length
Example
let text = "Pushpendra";
[Link](text)
[Link]
JAVASCRIPT
JavaScript String Methods
String length
String slice()
String substring()
String substr()
String replace()
String replaceAll()
String toUpperCase()
String toLowerCase()
String concat()
[Link]
JAVASCRIPT
JavaScript String Methods
10. String trim()
11. String trimStart()
12. String trimEnd()
13. String padStart()
14. String padEnd()
15. String charAt()
16. String charCodeAt()
17. String split()
[Link]
JAVASCRIPT
JavaScript Template Literals
Template Literal
Template String
String Template
Back-Tics Syntax
Back-Tics Syntax
Template Literals use back-ticks (``) rather
than the quotes ("") to define a string:
Example
let text = `Pushpendra`;
[Link](text)
[Link]
JAVASCRIPT
JavaScript Template Literals
Quotes Inside Strings
With template literals, you can use both single
and double quotes inside a string:
Example
let text = `He's often called "Push"`;
[Link](text)
Multiline Strings
Template literals allows multiline strings:
[Link]
JAVASCRIPT
JavaScript Template Literals
Example
let text =
`The quick
brown fox
jumps over
the lazy dog`;
[Link](text)
Variable Substitutions
Template literals allow variables in strings:
[Link]
JAVASCRIPT
JavaScript Template Literals
Example
let firstName = "Pushpendra";
let lastName = "Tripathi";
let text = `Welcome ${firstName}, ${lastName}!`;
[Link](text)
JavaScript Date Formats
JavaScript Date Input
ISO Date "2015-03-25" (The International Standard)
Short Date "03/25/2015"
Long Date "Mar 25 2015" or "25 Mar 2015"
[Link]
JAVASCRIPT
Storage API
Storage Object Properties and Methods
1- clear()
2- getItem()
3- key()
4- length
5- setItem()
6- removeItem()
7- [Link]
8- [Link]
[Link]
JAVASCRIPT
Console API
The Console Object
The console object provides access to the browser's
debugging console.
1- assert()
9- log()
2- clear()
10- table()
3- count()
11- time()
4- error()
12- timeEnd()
5- group()
13- trace()
6- groupCollapsed()
14- warn()
7- groupEnd()
8- info()
[Link]
JAVASCRIPT
JavaScript Array Object
1- concat()
13- indexOf()
25- reverse()
2- constructor
14- isArray()
26- shift()
3- copyWithin()
15- join()
27- slice()
4- entries()
16- keys()
28- some()
5- every()
17- lastIndexOf()
29- sort()
6- fill()
18- length
30- splice()
7- filter()
19- map()
31- toString()
8- find()
20- pop()
32- unshift()
9- findIndex()
21- prototype
33- valueOf()
10- forEach()
22- push()
11- from()
23- reduce()
12- includes() 24- reduceRight()
[Link]
JAVASCRIPT
JSON Data Types
JSON Strings
JSON Arrays
Example
Example
{"name":"push"} {"employees":["Push", "Anna", "Peter"]}
JSON Booleans
JSON Numbers
Example
Example
{"sale":true}
{"age":30} JSON null
Example
JSON Objects
{"middlename":null}
Example
{"employee":{"name":"Push", "age":20, "city":"New York"}}
[Link]
JAVASCRIPT
console in JavaScript
info() method
Example
clear() Method
let tips = "Pushpendra Tripathi"
Example
[Link](tips);
let tips = "PushpendraTips"
[Link](tips)
[Link]() log() Method
Example
let tips = "Pushpendra Tripathi"
error() Method
[Link](tips);
Example
let name = "Pushpendra"
[Link](name,’This is a simple error’);
[Link]
JAVASCRIPT
console in JavaScript
warn() Method
Example
let tips = "This is a warning!"
[Link](tips);
table() method =>Array
Example
[Link](["HTML","CSS","JAVASCRIPT"]);
table() method =>Object
Example
({fName:"Pushpendra", lName:"Tripathi"});
[Link]
Pushpendra Tripathi
Thanks for reading!
Follow my profile for more
coding related contents
Twitter: [Link]
Instagram: [Link]
Telegram: [Link]