You are on page 1of 7

JAVASCRIPT SESSIONS

JAVASCRIPT SESSION 1

JAVASCRIPT SESSION 1 RECORDING:

https://transcripts.gotomeeting.com/#/s/
28006b79d614b7ec8b5e944b4e86f22e9cd008b13ed5cf301e4fb724068d0c7f

- Programming Language just like C#, Java, C++ etc..


- We can use Javascript as a client side as well as server side language (using Node.JS)
- Most of that time we use it as a client side scripting language
- To manipulate html elements
- To validate user input
- To communicate with server side code
- Faster language
- Dis advantages:
o Javascript code is not secure
o Browser compatibility issue

Datatypes

- We have all datatypes available in javascript


- It is not strongly typed language means we cannot use int, string like keywords
- We have types like Number, String, Boolean, Object

Variables

- We cannot write direct type name we use var, let or const keyword to declare a variable
- With var keyword
o We get global & function scope only not block scope

JAVASCRIPT SESSION 2

JAVASCRIPT SESSION 2 RECORDING:

https://transcripts.gotomeeting.com/#/s/
51fd54b948e1a6b4d932a23c0df15693d180114935278a288c7b6ec780c311e0
To apply javascript on html page

- 1. Inline javascript
o Using html attributes events name starts with on-
- 2. Internal javascript
o Using script tag
o It is always good to load javascript as late as possible
- 3. External javascript
o Using a separate javascript file

Datatype

Number type

Boolean type

String type

JAVASCRIPT SESSION 3

JAVASCRIPT SESSION 3 RECORDING:

https://transcripts.gotomeeting.com/#/s/
e3c3f90a7085536a7e784fc7a38182c310d104aaf565928b157d79b8e1788770

String functions

Conditional statements

If

If else

Ternary operator

If else if chain / ladder

Switch

Array

- Mutator functions – function changes original array itself like push(), unshift(), pop(), shift(),
splice()
- Reverse(), sort(), filter()
Looping statements

- While
- Do while
- For loop
- Advanced for loop

JAVASCRIPT SESSION 4

JAVASCRIPT SESSION 4 RECORDING:

https://transcripts.gotomeeting.com/#/s/
e77661c7852a3c2d5fa7f82b49637e0da687c151e08e8a4f2d3d1afac6f10341

Function

- Javascript function always returns a value – undefined


- Function hoisting
o Javascript moves all function declaration before their calls
- To declare function
o Normal function declaration
o Function as expression / anonymous function
▪ Function hoisting will not work
o Recursive function
o Self executing function (IIFE – immediately invoked function expression)
- Closure function
o Function within function
- Variable hoisting may or may not work

JAVASCRIPT SESSION 5

JAVASCRIPT SESSION 5 RECORDING:

https://transcripts.gotomeeting.com/#/s/
6ca4db2ebfd407e5c548194713760b8e6afb59f1037f5450a7a077579f17d0e8

Error handling in javascript

- Using try catch block


- window onerror event
Date in javascript

Timing events

- setInterval
- clearInterval
- setTimeout
- clearTimeout

JAVASCRIPT SESSION 6

JAVASCRIPT SESSION 6 RECORDING:

https://transcripts.gotomeeting.com/#/s/
018a72f2f81446dce608dd2653e81b186c5949c21c4d28f4eced1db8244a1e7d

DOM

- document object model


- DOM gets created once entire html gets loaded on browser
- Browser creates DOM – document
- DOM contains entire information about html page & its elements
Get value/ content from html element

- value
- innerText
- innerHTML

JAVASCRIPT SESSION 7

JAVASCRIPT SESSION 7 RECORDING:

https://transcripts.gotomeeting.com/#/s/
b34a78ae7163d284d1299e1049958d09eb91a3c553a04a4c3d6e3507d51a8a06

Events

- any action performed on browser page, if we want to track or execute any javascript code
- we have key events, mouse events
- mouse events
o mouse over
o mouse out
o mouse move
o mouse down
o mouse up
o mouse click
o mouse double click
o context menu – to identify right click
- to register event we have different ways
o using html attribute
o using DOM object property
o using special methods like addEventListener, removeEventListener
- event bubbling
o if we have nested html elements, all elements assigned with events in this case
when inner element events gets triggered, it fires all events from inner to outer
elements
o events gets bubbled from inner to outer element
o preventing event bubbling
▪ stopPropagation()
- event capturing
o opposite to event bubbling
o events gets fired from outer to inner element
- event object
o it contains information about element on which event happened
o event.which property to know which button is clicked on mouse
▪ left button = 1
▪ middle button = 2
▪ right button = 3
- Preventing browser default actions
o Like right click
o Task
▪ Prevent copying content from page
▪ Prevent paste in textbox or textarea

JAVASCRIPT SESSION 8

JAVASCRIPT SESSION 8 RECORDING:

https://transcripts.gotomeeting.com/#/s/
abf5a242bb53a9a06d1535b918936b3a9ce17465add36d6d68e5af6d26b3fbec

Window.open()

- To open / visit a site

Regular expression
- We use regular expression to validate patterns
- Pattern like email, strong password, pin code, mobile number etc..

JAVASCRIPT SESSION 9

JAVASCRIPT SESSION 9 RECORDING:

https://transcripts.gotomeeting.com/#/s/
7bb703b50a72fdf5d18fb6b6749929f11e0120f37405eff86ef28ac94b02d6e8

Regular expression:

To check pattern

Visit:

https://regexlearn.com/learn

https://regexone.com

You might also like