Unit4_WT
Unit4_WT
WEB TECHNOLOGY
Unit: 4
Web Technology
ACSE-0505
Ms Vaishali Mishra
Asstt Professor
B.Tech 5th Sem CSE Department
JavaScript Essentials: Introduction to Java Script , Java script Types , Var, Let
and Const Keywords, Operators in JS , Conditions Statements , Java Script
Loops, JS Popup Boxes , JS Events , JS Arrays, Working with Arrays, JS
Objects ,JS Functions , Using Java Script in Real time , Validation of Forms,
Arrow functions and default arguments, Template Strings, Strings methods,
Callback functions,
Object de-structuring, Spread and Rest Operator, Typescript fundamentals,
Typescript OOPs- Classes, Interfaces, Constructor etc. Decorator and Spread
Operator,
Difference == & ===, Asynchronous Programming in ES6, Promise
Constructor, Promise with Chain, Promise Race.
Text books:
1. Steven M. Schafer, “HTML, XHTML, and CSS Bible, 5ed”, Wiley India
2. Ian Pouncey, Richard York, “Beginning CSS: Cascading Style Sheets for Web
Design”, Wiley India
Sample Applications
Desktop GUI Applications
Mobile Applications
Enterprise Applications
Scientific Applications
Web-based Applications
Cloud-based Applications
Web servers and Application servers
Software Tools
• 1. Engineering knowledge:
• 2. Problem analysis:
• 3. Design/development of solutions:
• 4. Conduct investigations of complex problems:
• 5. Modern tool usage:
• 6. The engineer and society:
• 7. Environment and sustainability:
• 8. Ethics:
• 9. Individual and team work:
• 10. Communication:
• 11. Project management and finance:
• 12. Life-long learning
6/04/2023 ACSE0505 (Web Tech) Unit 4 16
CO-PO Mapping
Mapping of Course Outcomes and Program Outcomes:
• PSO1: Identify, analyze real world problems and design their ethical
solutions using artificial intelligence, robotics, virtual/augmented
reality, data analytics, block chain technology, and cloud computing.
• PSO2:Design and develop the hardware sensor devices and related
interfacing software systems for solving complex engineering
problems.
• PSO3:Understand inter-disciplinary computing techniques and to
apply them in the design of advanced computing.
• PSO4: Conduct investigation of complex problems with the help of
technical, managerial, leadership qualities, and modern engineering
tools provided by industry-sponsored laboratories.
CO1 3 1 1 1
CO2 1 2 3 1
CO3 2 3 2 1
CO4 3 2 3 2
CO5 2 1 2 3
B TECH
(SEM-V) THEORY EXAMINATION 20__-20__
Time: 3 Hours Total
Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose
suitably.
SECTION A
1. Attempt all questions in brief. 1 x 10 =
10
Q.No. Question Marks CO
1 1
2 1
. .
10 1
SECTION B
3. Attempt any five part of the following: 5 x 6 = 30
1 6
. 6
7 6
6/04/2023 ACSE0505 (Web Tech) Unit 4 23
End Semester Question Paper Templates
1 10
2 10
5. Attempt any one part of the following: 1 x 10 = 10
Q.No. Question Marks CO
1 10
2 10
6. Attempt any one part of the following: 1 x 10 = 10
Q.No. Question Marks CO
1 10
2 10
1 10
2 10
Objective of Unit 4:
• To understand the basics of working with objects in JavaScript: creating
objects, accessing and modifying object properties using constructors.
understating various function, loop, array, string etc.
What is JavaScript?
JavaScript is a programming language used to make websites interactive. If you think about the basic
makeup of a website, you have HTML, which describes and defines the basic content and structure
of the website, then you have CSS, which tells the browser how this HTML content should be
displayed—determining things like color and font.
With just HTML and CSS, you have a website that looks good but doesn’t actually do much.
JavaScript brings the website to life by adding functionality. It’s is responsible for elements that the
user can interact with, such as drop-down menus, modal windows, and contact forms. It is also used
to create things like animations, video players, and interactive maps
• Function
. expressions can be made "self-invoking".
• A self-invoking expression is invoked (started) automatically, without being called.
• Function expressions will execute automatically if the expression is followed by ().
• You cannot self-invoke a function declaration.
• we have to add parentheses around the function to indicate that it is a function
expression:
Example
(function () {
let x = "Hello!!"; // I will invoke myself
})();
Number type
var enrollment = 99;
var medianGrade = 2.8;
Vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
var credits = 5 + 4 + (2 * 3);
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
JS
integers and real numbers are the same type (no int vs. double)
same operators: + - * / % ++ -- = += -= *= /= %=
similar precedence to Java
many operators auto-convert types: "2" * 3 is 6
// single-line comment
/* multi-line comment */
JS
Math object
methods: abs, ceil, cos, floor, log, max, min, pow, random, round,
sin, sqrt, tan
properties: E, PI
Logical operators
Boolean type
var iLike190M = true;
var ieIsGood = "IE6" > 0; // false
if ("web devevelopment is great") { /* true */ }
if (0) { /* false */ }
JS
any value can be used as a Boolean
"falsey" values: 0, 0.0, NaN, "", null, and undefined
"truthy" values: anything else
converting a value into a Boolean explicitly:
var boolValue = Boolean(otherValue);
var boolValue = !!(otherValue);
while (condition) {
statements;
} JS
do {
statements;
} while (condition);
JS
alert("message"); // message
confirm("message"); // returns true or false
prompt("message"); // returns user input string
JS
Event Description
onchange An HTML element has been
changed
onclick The user clicks an HTML
element
onmouseover The user moves the mouse
over an HTML element
onmouseout The user moves the mouse
away from an HTML element
onkeydown The user pushes a keyboard
key
onload The browser has finished
loading the page
Event handlers can be used to handle and verify user input, user
actions, and browser actions:
Things that should be done every time a page loads
Things that should be done when the page is closed
Action that should be performed when a user clicks a button
Content that should be verified when a user inputs data
And more ...
Many different methods can be used to let JavaScript work with events:
HTML event attributes can execute JavaScript code directly
HTML event attributes can call JavaScript functions
You can assign your own event handler functions to HTML elements
You can prevent events from being sent or being handled
And more ...
• All cars have the same properties, but the property values differ from car to
car.
• All cars have the same methods, but the methods are performed at different
times.
JavaScript Objects
• This code assigns a simple value (Fiat) to a variable named car:
let car = "Fiat";
Objects are variables too. But objects can contain many values.
this code assigns many values (Fiat, 500, white) to a variable named
car:
const car = {type:"Fiat", model:"500", color:"white"};
Object Definition
• You define (and create) a JavaScript object with an object literal:
Example
const person = {firstName:"John", lastName:"Doe", age:50,
eyeColor:"blue"};
• Spaces and line breaks are not important. An object definition can
span multiple lines:
const person = {
firstName: "John",
lastName: "Doe",
6/04/2023 ACSE0505 (Web Tech)50,
age: Unit 4 50
Contd….
Object Properties
The name : values pairs in JavaScript objects are called properties
Property Property Value
firstName John
lastName Doe
age 50
eyeColor blue
// ES6
const x = (x, y) => x * y;
Arrow functions do not have their own this. They are not well suited for
defining object methods
Arrow functions are not hoisted. They must be defined before they are
used
Using const is safer than using var, because a function expression is
always constant value.
You can only omit the return keyword and the curly brackets if the
function is a single statement. Because of this, it might be a good habit
to always keep them:
Example
const x = (x, y) => { return x * y };
JavaScript let
JavaScript let is used to declare variables. Previously, variables were
declared using the var keyword
The variables declared using let are block-scoped. This means they
are only accessible within a particular block. For example,
JavaScript const
The const statement is used to declare constants in JavaScript. For
example,
can be written as
JavaScript Classes
JavaScript class is used to create an object. Class is like a
constructor function. For example,
class Person {
constructor(name) {
this.name = name;
}
}
(A)Angular
(B)React
(C)Vue
(D)All of them
[Q5]. What is the difference between the operators ‘==‘ & ‘===‘?
[Q6]. In how many ways a JavaScript code can be involved in an HTML file?
(E)Inline
(F)Internal
(G)External
(H)All of them
[Q7] List out the different ways an HTML element can be accessed in a JavaScript code.
(i) getElementById(‘idname’): Gets an element by its ID name
(ii) getElementsByClass(‘classname’): Gets all the elements that have the given class name.
(iii) getElementsByTagName(‘tagname’): Gets all the elements that have the given tag name.
(iv) querySelector(): This function takes CSS style selector and returns the first selected element.
(v) All of them.
6/04/2023 ACSE0505 (Web Tech) Unit 4 72
MCQ s(Cont..)
A) <h1>
B) <h6>
C) <heading>
D) <head>
Sessional Papers
Ivan Bayross,” HTML, DHTML, Java Script, Perl & CGI”, BPB
Publication
Unit 1
https://youtu.be/96xF9phMsWA
https://youtu.be/Zopo5C79m2k
https://youtu.be/ZliIs7jHi1s
https://youtu.be/htbY9-yggB0
Unit 2
https://youtu.be/vHmUVQKXlVo
https://youtu.be/qz0aGYrrlhU
Unit 3
https://youtu.be/1Rs2ND1ryYc
Unit 4
https://youtu.be/-qfEOE4vtxE
https://youtu.be/PkZNo7MFNFg
Unit 5
https://youtu.be/_GMEqhUyyFM