It Te V WD Week 1 Adjs
It Te V WD Week 1 Adjs
2 Syllabus
Course Description
3 Syllabus
Course Objectives
6) To build web applications quickly and with less code using Flask
framework.
4 Syllabus
Course Outcomes
less code.
5 Syllabus
Module 1 : Advanced JavaScript [CO1] [6H]
JSON –
JSON Array,
JS Arrow Functions,
JS Callback Functions,
JS Promises,
JS Async-Await Functions,
JS Error Handling
6 Syllabus
Module 2 : Front End Technologies [CO2] [8H]
Front-End Frameworks:
MVC Architecture,
MVC in Practical,
7 Syllabus
Module 2 : Front End Technologies [CO2] [8H]
8 Syllabus
Module 3 : Back End Technologies [CO3] [8H]
9 Syllabus
Module 4 : Mobile Web Development [CO4] [7H]
Formatting Lists, Header and Footer, CSS Classes, Data Attributes, Building a Simple
Mobile Webpage.
10 Syllabus
Module 5 : Web ApplicationDeployment [CO5] [5H]
Cloud: AWS Cloud, AWS Elastic Compute, AWS Elastic Load Balancer and its types,
AWS VPC and Component of VPC, AWS storage, Deploy Website or Web Application
11 Syllabus
Module 6 : Flask [CO6] [5H]
Flask: Introduction, Flask Environment Setup, App Routing, URL Building, Flask
HTTP Methods, Flask Request Object, Flask cookies, File Uploading in Flask
12 Syllabus
Contents
Lecture 1
Introduction to JavaScript
Module 1 : Introduction to JavaScript
✓ JavaScript is an object-
based programming language that
supports polymorphism,
encapsulation, and inheritance as well.
Module 1 : JavaScript
19
Mrs. Sujata Oak
What can JavaScript do?
4. Most popular websites like Google, Facebook, Netflix, Amazon, etc make use
of JavaScript to build their websites.
Module 1 : JavaScript
20
Mrs. Sujata Oak
JavaScript Framework
Module 1 : JavaScript
21
Mrs. Sujata Oak
The Big Picture : HTML, CSS and JavaScript
Module 1 : JavaScript
22
Mrs. Sujata Oak
HTML vs CSS vs JavaScript
HTML (HyperText Markup Language) is more like the skeleton of the web. It
is used for displaying the web.
CSS is like our clothes. It makes the web look better. It uses CSS which stands
for Cascading Style Sheets for styling purpose.
JavaScript is used to add life to a web page. Just like how kids move around
using the skateboard, the web also motions with the help of JavaScript.
Module 1 : JavaScript
23
Mrs. Sujata Oak
Top Website Built Using JavaScript
Module 1 : JavaScript
24
Mrs. Sujata Oak
Benefits of JavaScript
Module 1 : JavaScript
25
Mrs. Sujata Oak
Benefits of JavaScript
Module 1 : JavaScript
26
, Mrs. Sujata Oak
Benefits of JavaScript
Module 2 : JavaScript
27
TE-B, Mrs. Sujata Oak
Benefits of JavaScript
and MeteorJS
Module 1 : JavaScript
28
Mrs. Sujata Oak
WEB DEVELOPEMENT IDEs
Integrated Development
Environments (IDEs) are the
tools that are extremely
important when it comes to
coding. In today’s market,
you’d find an enormous
number of IDEs that serve
different purposes.
As a result, it gets really
confusing to select one IDE
that will serve all your
requirements.
Below are the Top IDEs for
Web Development
Module 1 : JavaScript
29
Mrs. Sujata Oak
Introduction to ES6
Module 1 : JavaScript
30
Mrs. Sujata Oak
Version of JavaScript
Module 1 : JavaScript
31
Mrs. Sujata Oak
Module 1 : How to Run JavaScript?
JavaScript cannot run on its own. In fact, the browser is responsible for running
JavaScript code.
When a user requests an HTML page with JavaScript in it, the script is sent to the
browser and it is up to the browser to execute it.
You should place all your JavaScript code within <script> tags (<script> and </script>)
if you are keeping your JavaScript code within the HTML document itself.
This helps your browser distinguish your JavaScript code from the rest of the code.
You have to use the type attribute within the <script> tag and set its value to
text/javascript like this:
<script type="text/javascript">
DEMO: Firstjs.html
•JavaScript can be run on any operating systems and almost all web
browsers.
•You need a text editor to write JavaScript code and a browser to display your
web page.
It is a good
programming variable names
practice to give should start with
descriptive and a letter and they
meaningful are case sensitive
names to the
variables. studentname
and
studentName are
different
DEMO: Variabl.html
Arrays become really useful when you need to store large amounts of data of the
same type.
If you are using variables, you will have to create 500 variables whereas you can do
the same with a single array.
You can access the items in an array by referring to its indexnumber and the index of
the first element of an array is zero.
If you want to add more elements to the students array, you can do it like this:
You can also create an array using Array constructor like this:
OR
The Array object has many properties and methods which help developers to handle
arrays easily and efficiently.
You can get the value of a property by specifying arrayname.property and the output of
a method by specifying arrayname.method().
1.length property –> If you want to know the number of elements in an array, you can
use the length property.
2.reverse method –> You can reverse the order of items in an array using a reverse
method.
3.sort method –> You can sort the items in an array using sort method.
4.pop method –> You can remove the last item of an array using a pop method.
5.shift method –> You can remove the first item of an array using shift method.
6.push method –> You can add a value as the last item of the array.
Demo: Array.html
ES6 Decision-Making
if, if---else, if--else if—else,switch
ES6 Looping
Definite Loops : for , for—in , for-of
Indefinite Loops : while , do-while
Loops are useful when you have to execute the same lines of
ES6 Loops code repeatedly, for a specific number of times or as long as a
specific condition is true.
For-of
Definite Loops :
For(;;)
For…in
For…of
InDefinite Loops :
While
Do-while
Module 1 : JavaScript
46
Mrs. Sujata Oak
ES6 Loops
Module 1 : JavaScript
47
Mrs. Sujata Oak
ES6 While Loops
Module 1 : JavaScript
48
Mrs. Sujata Oak
ES6 While Loops
Module 1 : JavaScript
50
Mrs. Sujata Oak
ES6 Decision-making : Conditional Statements : If
Module 1 : JavaScript
51
Mrs. Sujata Oak
ES6 Decision-making : Conditional Statements : ElseIf
Module 1 : JavaScript
52
Mrs. Sujata Oak
ES6 Decision-making : Conditional Statements : Switch Case Statement
Module 1 : JavaScript
53
Mrs. Sujata Oak
JavaScript Define & Call Functions with Example
Functions are very important and useful in any programming language as they make
the code reusable .
If you have a few lines of code that needs to be used several times, you can create a
function including the repeating lines of code and then call the function wherever you
want.
Module 1 : JavaScript
54
Mrs. Sujata Oak
JavaScript Define & Call Functions with Example
Syntax:
function functionname()
{
lines of code to be executed
}
DEMO:simplefunc.html
Module 1 : JavaScript
55
Mrs. Sujata Oak
JavaScript Define & Call Functions with Example
You can create functions with arguments as well. Arguments should be specified
within parenthesis
DEMO:argfunc.html
Module 1 : JavaScript
56
Mrs. Sujata Oak
JavaScript Define & Call Functions with Example
You can also create JS functions that return values. Inside the function, you need to
use the keyword return followed by the value to be returned.
Syntax:
function functionname(arg1, arg2)
{
lines of code to be executed
return val1;
}
DEMO:returnfunc.html
Module 1 : JavaScript
57
Mrs. Sujata Oak
Practical Code Examples using JavaScript
DEMO:Example1.html DEMO:Example2.html
DEMO:Example3.html
Module 1 : JavaScript
58
Mrs. Sujata Oak
Application of JavaScript
Java Script
Script.
Module 1 : JavaScript
59
Mrs. Sujata Oak
At A Glance!!!
HTML and CSS are markup languages. Markup languages are used to describe
and define elements within a document. JavaScript is a programming language.
Programming languages are used to communicate instructions to a machine.
Programming languages can be used to control the behavior of a machine and to
express algorithms.
https://en.wikipedia.org/wiki/JavaScript#History
Module 1 : JavaScript
60
Mrs. Sujata Oak
HOW TO WRITE JAVASCRIPT CODE?
Module 1 : JavaScript
61
Mrs. Sujata Oak
Questions
Module 1 : JavaScript
62
Mrs. Sujata Oak
Lecture 2
ADVANCED JAVASCRIPT
Introduction to JSON
Module 1 : JavaScript
64
Mrs. Sujata Oak
Why use JSON?
3. In December 2005, Yahoo! starts offering some of its web services in JSON.
Module 1 : JavaScript
66
Mrs. Sujata Oak
Features of JSON
1. Easy to use – JSON API offers high-level facade, which helps you to simplify
commonly used use-cases.
2. Performance – JSON is quite fast as it consumes very less memory space, which is
especially suitable for large object graphs or systems.
3. Free tool – JSON library is open source and free to use.
4. Dependency – JSON library does not require any other library for processing.
Module 1 : JavaScript
67
Mrs. Sujata Oak
Rules for JSON Syntax
Module 1 : JavaScript
68
Mrs. Sujata Oak
Data Types in JSON
Module 1 : JavaScript
69
Mrs. Sujata Oak
JSON Object
{
"book": [{
"id": "444",
"language": "C",
"edition": "First",
"author": "Dennis Ritchie "
},
{
"id": "555",
"language": "C++",
"edition": "second",
"author": " Bjarne Stroustrup "
}
]
Link: https://jsonformatter.curiousconcept.c
}
om/
Link: https://jsonlint.com
Module 1 : JavaScript
71
Mrs. Sujata Oak
Creation of JSON Object with JavaScript
Ex:
var stud = {
“name”:”Sujata”,
“Roll_No”:799,
“city”:”thane”
};
Jojs.html
Module 1 : JavaScript
72
Mrs. Sujata Oak
JSON ARRAY Jsonarr.html
✓ Arrow functions are introduced in ES6, which provides you a more accurate way
to write the functions in JavaScript.
Module 1 : JavaScript
74
Mrs. Sujata Oak
JS Arrow Functions / ES6 Arrow Function
Module 1 : JavaScript
75
Mrs. Sujata Oak
Arrowfunc.html
// function expression
var myfunc1=function show(){
console.log("It is a Function Expression");
}
// Anonymous function
var myfunc2=function(){
console.log("It is an Anonymous Function");}
//Arrow function
var myfunc3 = () => {
console.log("It is an Arrow Function");
};
myfunc1();
myfunc2();
myfunc3();
Module 1 : JavaScript
76
Mrs. Sujata Oak
JS Arrow Functions / ES6 Arrow Function
Syntactic Variations
Module 1 : JavaScript
77
Mrs. Sujata Oak
JS Arrow Functions / ES6 Arrow Function
Module 1 : JavaScript
78
Mrs. Sujata Oak
JS Arrow Functions / ES6 Arrow Function
Module 1 : JavaScript
79
Mrs. Sujata Oak
JavaScript CallBack Function
greet('Kajol'); // Hi Kajol
In the above program, a string value is passed as an argument to the greet() function.
Module 1 : JavaScript
80
Mrs. Sujata Oak
JavaScript CallBack Function
Module 1 : JavaScript
81
Mrs. Sujata Oak
JavaScript CallBack Function
<head>
<title>JS Callback Function</title>
<script>
// function
function mul(a,b,callback) {
res=a*b
document.write("Result Is:"+res);
callback();
}
function display(){
document.write("<br/> Welcome to session on JS Callback
Function");
}
</script>
</head>
<body>
<script>
mul(10,20,display);
</script>
</body>
</html>Module 1 : JavaScript
82
Mrs. Sujata Oak
Benefit of Callback Function
You can wait for the result of a previous function call and then
execute another function call.
Module 1 : JavaScript
83
Mrs. Sujata Oak
Program with setTimeout()
Module 1 : JavaScript
84
Mrs. Sujata Oak
JavaScript Synchronous Programming
function myfun(){
console.log("Inside
Function")
}
console.log("start")
myfun()
console.log("end")
Module 1 : JavaScript
85
Mrs. Sujata Oak
JavaScript Asynchronous Programming
Module 1 : JavaScript
86
Mrs. Sujata Oak
JavaScript Asynchronous Programming
Module 1 : JavaScript
87
Mrs. Sujata Oak
JavaScript Asynchronous Programming
console.log("start")
setTimeout(()=>{
console.log("Inside setTimeOut")
},5000)
console.log("end")
Module 1 : JavaScript
88
Mrs. Sujata Oak
JavaScript CallBack Function can be Synchronous
console.log("start")
const roll=[1,2,3,4,5]
roll.forEach(r=>{
console.log(r)
})
console.log("End")
Module 1 : JavaScript
89
Mrs. Sujata Oak
JavaScript Promises
Module 1 : JavaScript
90
Mrs. Sujata Oak
JavaScript Promises
Module 1 : JavaScript
91
Mrs. Sujata Oak
JavaScript Promises
For example,
Module 1 : JavaScript
92
Mrs. Sujata Oak
JavaScript Promises
Create a Promise:
To create a promise object, we use the Promise() constructor.
Module 1 : JavaScript
93
Mrs. Sujata Oak
Example 1: Program with a Promise
JavaScript Promises
Prom2.js , external.html
Module 1 : JavaScript
95
Mrs. Sujata Oak
JavaScript Promises
When the Promise gets resolved, something will happen next that
depends on what we want to do with the resolved Promise.
myPromise.then();
myPromise.then((message)=>{
console.log(message);
});
Module 1 : JavaScript
96
Mrs. Sujata Oak
JavaScript Promises
Prom.html
.catch(); method
This method is called when the promise is rejected (or failed). And
we can also pass a message in it for the user. We can write the catch
method just after the "then ()" method.
myPromise.then((message)=>{
console.log(message);
}).catch((message)=>{
console.log(message);
});
Module 1 : JavaScript
97
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
98
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
99
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
100
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
101
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
102
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
103
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
104
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
105
Mrs. Sujata Oak
JavaScript Promises : Conclusion
Module 1 : JavaScript
106
Mrs. Sujata Oak
JavaScript Async/Await
Module 1 : JavaScript
107
Mrs. Sujata Oak
JavaScript Async/Await
SYNTAX:
async function name(parameter1, parameter2, ...paramaterN)
{
// statements
}
Module 1 : JavaScript
108
Mrs. Sujata Oak
JavaScript Async/Await : Example: Async Function
Module 1 : JavaScript
109
Mrs. Sujata Oak
JavaScript Async/Await : Example: Async Function
fun().then(function(result) {
console.log(result)
});
Module 1 : JavaScript
110
Mrs. Sujata Oak
JavaScript Async/Await : Example: Await Function
Module 1 : JavaScript
111
Mrs. Sujata Oak
JavaScript Async/Await : Example: Await Function
The await keyword is used inside the async function to wait for
the asynchronous operation.
Module 1 : JavaScript
112
Mrs. Sujata Oak
JavaScript Async/Await : Example: Await Function
// a promise
let promise = new Promise(function (resolve, reject) {
setTimeout(function () { resolve('Promise resolved')}, 4000); }); //
async function async function asyncFunc() { // wait until the promise
resolves let result = await promise; console.log(result);
console.log('hello'); } // calling the async function asyncFunc();
Module 1 : JavaScript
113
Mrs. Sujata Oak
JavaScript Async/Await
http://localhost:9191/async_await2.html
Module 1 : JavaScript
114
Mrs. Sujata Oak
JavaScript Error Handing
https://www.programiz.com/javascript/async-await
Module 1 : JavaScript
115
Mrs. Sujata Oak
116