22it407 WDF Unit1 Digital Material 2024-25 Even
22it407 WDF Unit1 Digital Material 2024-25 Even
2
Please read this disclaimer before proceeding:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document
contains proprietary information and is intended only to the respective group /
learning community as intended. If you are not the addressee you should not
disseminate, distribute or copy through e-mail. Please notify the sender
immediately by e-mail if you have received this document by mistake and delete
this document from your system. If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in reliance on
the contents of this information is strictly prohibited.
22CS403/22IT403/22IT407
WEB DEVELOPMENT FRAMEWORKS
(Lab Integrated)
Batch / Year / Semester: 2023-2027 / II / 4
4
1. CONTENTS
S.NO. CONTENTS PAGE NO
1 Contents 4
2 Course Objectives 5
3 Pre Requisites 6
4 Syllabus 7
5 Course Outcomes 12
6 CO- PO/PSO Mapping 13
7 Lecture Plan 14
8 Activity Based Learning 15
9 Lecture Notes 17-42
10 Assignment – 1 to 5 43-45
11 Part A Questions & Answers 46-47
12 Part B Questions 48-49
Supportive Online Certification
13 50
Courses
14 Real time Applications 51-52
15 Contents Beyond the Syllabus 53
16 Assessment Schedule 54
Prescribed Text Books & Reference 55
17
Books
18 Mini Project – 1 to 5 56-57
5
2. COURSE OBJECTIVES
OBJECTIVES:
6
3. PRE REQUISITES
• Pre-requisite Chart
22CS403/22IT403/22IT407
WEB DEVELOPMENT
FRAMEWORKS
22CS102
SOFTWARE DEVELOPMENT PRACTICES
7
4. Syllabus
22IT407 – WEB DEVELOPMENT FRAMEWORKS (Lab Integrated) – L T P C - 3 0 2 4
6
4. Syllabus
1) Develop a Scientific calculator that does following operations
➢ Rounded Value
➢ Area of Circle
➢ Calculating of Sin, Cos and Tan functions
➢ Permiter of a Rectangle
➢ Employ Arrow functions
➢ Employ HOC
UNIT III - REACT COMPONENTS – 9+6
Class vs Functional Components, Lifecycle methods - React Class Based Components
– component DidMount, WillUpdate, shouldupate, didcatchetc - State - UseState,
UseRef, USeEffect,UseHistory Usage and Props(difference, when to use what, mutable
or immutabilty,direction of flow), PropTypes, Auxillary Components, Controlled and
Uncontrolled Components,Component Interaction (Parent to Child and Child to
Parent), Iteration & Conditional Response
List of Exercise/Experiments
1) Create a collection of Customer by using
➢ Weak Map and Map Collection in JS
➢ Show Case the different feature set of the same.
2) Add Login Page, Dash Board Page, Admin Page
➢ Enable React Routing
➢ Add React Protected Route, for authorization
UNIT IV - REACT LIBRARY – I – 9+6
Event Bubbleup - Component Wrapper - Integration of CSS Modules - Forms
Validations(YUP, Formik, Standard), Events Handling, Data Binding - Redux
List of Exercise/Experiments
1) Develop a React application that has User Registration Form w field
level validations, data submission to a rest api end point, boot strap
for responsive.
➢ Use YUP or Formik to implement the same
4. Syllabus
2) Build a Redux Counter Application
Requirements:
➢ React application with Redux integrated.
➢ A counter with:
➢ Increment button
➢ Decrement button
➢ Reset button
➢ Display the current counter value.
UNIT V - REACT LIBRARY – II – 9+6
Custom Hooks, HTTP - Fetch, Axios, and Context API, Services, Behaviour Subjects -
StateLess, StateFulll and Container Components, Error Handling - Build, Env, CORS, Unit
Testing w React Testing Library - Introduction to react-native - Introduction to
StoryBook
List of Exercise/Experiments
1) Employ backend API for Login Page functionality (authentication). Post login, store
the user context (received from the back end server) in browser’s session storage as
objects. And use the same as creds during protected route verification.
➢ On the dashboard page, have a grid of Students. The data has to be bought from
backend api
➢ Employ useref, useeffect & usestate, and useHistory
2) Enable Exception Handling
3) Enable HOC and Aux Components
4) Implement React-Testing Library
5) Basic Context Setup
Objective: Set up a React Context to manage theme (light or dark).
➢ Create a ThemeContext using React.createContext.
➢ Create a provider component ThemeProvider with state to toggle between
"light" and "dark" themes.
➢ Use the context in a functional component to display the current theme.
➢ Add a button to toggle the theme.
4. SYLLABUS
Business Use Case Implementations
3) E-Commerce System
4) Student LMS Management System
TOTAL:45+30=75 PERIODS
TEXTBOOK:
1. David Flanagan, Javascript The Definitive Guide, Paperback, 7th Edition, 2020.
2. David Choi ,Full-Stack React, TypeScript, and Node: Build cloud-ready web
applications using React 17 with Hooks and GraphQL Paperback – Import, 18
December 2020
3. Mehul Mohan, Advanced Web Development with React Paperback – 1 January
2020
E-RESOURCES:
1.Parental Website - https://reactjs.org/
2.The Road to Learn React: Your journey to master plain yet pragmatic React.js by
Robin Wieruch
3.Learning React: Functional Web Development with React and Redux by Alex Banks
and Eve Porcello
4. Learning React by KirupaChinnathambi
5. "React Up & Running" by StoyanStefanov
6. https://www.edureka.co/reactjs-redux-certification-training
7. CodePen
8. CodeSandbox (Preferred)
9. Stackblitz
11
4. SYLLABUS
LIST OF EQUIPMENTS:
• NodeJS (v9.11.2)
12
5. Course Outcomes
Course Outcomes with Knowledge Levels:
CO1: Personalize web pages using text formatting, graphics, audio,
and video. - K3
CO2: Hands on knowledge on Rest API , propTypes. - K3
CO3: Able to develop a web application using latest React
Framework – K3
CO4: Apply various React features including functions,
components, and services. – K3
CO5: Able to develop application using ReactJshooks. – K3
CO6: Design and integrate complex web components to enhance
user interface and user experience in React applications. – K5
11
6. CO-PO/PSO Mapping
CO2 3 2 3 1 2 - - - 2 1 - 1 - - -
CO3 3 3 3 1 2 - - 1 2 1 - 1 - - -
CO4 3 3 3 1 2 - - - 2 1 - 1 - - -
CO5 3 3 3 1 2 - - 1 2 1 - 1 - - -
CO6 2 3 3 - 3 - - 1 2 2 - 3 - - -
Correlation Level
1. Slight (Low)
2. Moderate (Medium)
3. Substantial (High) ,
If there is no correlation, put “-“.
12
7. LECTURE PLAN
Sl. Taxono
No. of. Proposed Actual Pertaining Mode of
No Topics my
Periods Date Date CO Delivery
. Level
Introduction to MD 1,
1 1 18.12.2024 18.12.2024 CO1, CO2 K3
HTML5 MD 4
Introduction to
MD 1,
2 CSS3, Media 1 19.12.2024 19.12.2024 CO1, CO2 K3
MD 4
Queries
MD 1,
3 Advanced JS 1 21.12.2024 21.12.2024 CO1, CO2 K3
MD 4
Document Object
MD 1,
4 Model , Variables 1 23.12.2024 23.12.2024 CO1, CO2 K3
MD 4
in JS
MD 1,
5 BootStrap 4 & 5 1 26.12.2024 26.12.2024 CO1, CO2 K3
MD 4
MD 1,
6 Loops , Operators 1 27.12.2024 27.12.2024 CO1, CO2 K3
MD 4
MD 1,
7 Hoisting, Arrays 1 28.12..2024 28.12.2024 CO1, CO2 K3
MD 4
MD 1,
8 Spread, REST 1 3.1.2025 3.1.2025 CO1, CO2 K3
MD 4
DeStructuring MD 1,
9 1 4.1.2025 4.1.2025 CO1, CO2 K3
MD 4
From From
10
18.12.2024 18.12.2024
- Lab Exercises 6 CO1, CO2 K3 Iamneo
To To
15
4.1.2025 4.1.2025
Common Activities
➢ Draw a detailed Mind Map diagram to create a visual representation of JavaScript's key
Include:
❑ Objects and their properties/methods, such as Math, Date, Array, Object, and String.
17
9. Lecture Notes
Unit I
ADVANCED JAVASCRIPT
18
9. Lecture Notes – Advanced JavaScript
Introduction to HTML5 and CSS3, Media Queries, JS, DOM, BootStrap, Variables,
Loops, Operators, Scope, Hoisting, Arrays, Spread, REST, DeStructuring
HTML5 and CSS3 are two essential technologies used for creating and styling websites.
HTML (Hypertext Markup Language) is responsible for structuring the content of a web
page, while CSS (Cascading Style Sheets) is used to define the presentation and visual
appearance of the HTML elements.
HTML5:
HTML5 is the latest version of HTML, which introduced several new features and
improvements over its predecessors. It provides a more robust and semantic way to
structure web content. Some key features of HTML5 include:
Semantic Elements: HTML5 introduced new semantic elements like <header>, <nav>,
<section>, <article>, <footer>, etc., which give more meaning and structure to
different parts of a web page.
Canvas and SVG: HTML5 introduced the <canvas> element, which allows dynamic
rendering of graphics, animations, and interactive content using JavaScript.
Additionally, HTML5 supports Scalable Vector Graphics (SVG) for creating resolution-
independent vector graphics on the web.
CSS3:
CSS3 is the latest version of CSS, which brought significant advancements in styling
and presentation capabilities. It provides a wide range of features and techniques to
style and layout HTML elements. Some notable features of CSS3 include:
19
9. Lecture Notes – Advanced JavaScript
Selectors : CSS3 introduced new and advanced selectors, allowing more
precise targeting of HTML elements based on various criteria.
Box Model Enhancements : CSS3 introduced properties like box-sizing
and border-radius to control the size, spacing, and shape of elements
more effectively.
Flexbox and Grid Layout: CSS3 introduced the Flexbox and Grid layout
models, which provide powerful and flexible ways to create responsive
and complex layouts.
Media Queries: CSS3 added Media Queries, which allow one to apply
different styles based on the device's screen size or other media-
specific conditions, enabling responsive design.
Media Queries
Media Queries work by using CSS rules that are applied only when
specific conditions are met. These conditions are defined using media
features, such a s screen size, device aspect ratio, device
orientation, and more. When a media feature matches the specified
condition, the associated CSS rules will be applied.
20
9. Lecture Notes – Advanced JavaScript
```css
body {
background-color: lightblue;
```
.my-element {
width: 50%;
height: 300px;
Here are some examples of media queries that target specific device features:
Media Queries can be placed directly in a CSS file or within the `<style>` tag of an
HTML document. By using Media Queries effectively, developers can create
responsive websites that adapt to different devices, ensuring optimal user
experiences across a wide range of screen sizes and devices.
JS
1. Variables and Data Types: JavaScript provides variables to store and manipulate
data. It supports various data types such as numbers, strings, booleans, arrays,
objects, and more. Variables can be declared using the `var`, `let`, or `const`
keywords.
22
9. Lecture Notes – Advanced JavaScript
4. DOM Manipulation: JavaScript can interact with the Document Object Model
(DOM) of a web page. It allows one to select elements, modify their content,
attributes, and styles, create new elements, attach event listeners, and respond to
user interactions.
6. Error Handling: JavaScript provides mechanisms for error handling and exception
handling. Developers can use try-catch blocks to catch and handle errors, preventing
the program from crashing.
JavaScript can be used not only in web browsers but also on the server-side with
technologies like Node.js. It has a wide range of applications, including web
development, mobile app development, game development, server-side
programming, and more.
To run JavaScript code, one can include it within `<script>` tags in an HTML file,
link an external JavaScript file, or use JavaScript within a dedicated JavaScript file.
Modern JavaScript development often involves using tools like package managers
(e.g., npm, yarn) and build systems (e.g., webpack, Babel) to manage
dependencies, bundle code, and optimize the development workflow.
DOM
The Document Object Model (DOM) is a programming interface for web documents.
It represents the structure of an HTML or XML document as a hierarchical tree-like
structure, where each element in the document is
23
9. Lecture Notes – Advanced JavaScript
represented by a node in the tree. The DOM provides a way to interact with and
manipulate the content, structure, and style of a web page dynamically using
scripting languages like JavaScript.
In simpler terms, the DOM acts as a bridge between web pages and scripts, allowing
scripts to access and modify the elements and content of a web page.
2. Nodes and Elements: In the DOM, different types of nodes represent different
elements or components of a web page. The most common types of nodes are
element nodes (representing HTML elements), text nodes (representing the text
within elements), and attribute nodes (representing attributes of elements). Other
types of nodes include comment nodes, document nodes, etc.
4. Modifying Nodes: Once one have selected a node, one can modify its content,
attributes, or style using JavaScript. For example, one can change the text inside an
element, add or remove classes, update attributes, create new elements, append or
remove nodes, and more.
5. Event Handling: The DOM allows one to handle various events, such as clicks,
mouse movements, form submissions, and keyboard interactions. one can attach
event listeners to specific nodes and define JavaScript code to be executed when an
event occurs. This enables interactivity and responsiveness in web applications.
24
9. Lecture Notes – Advanced JavaScript
6. Cross-Browser Compatibility: The DOM provides a standardized interface for web
scripting, ensuring cross-browser compatibility. However, different browsers may
have slight variations in their implementation, so it's important to consider browser
compatibility when working with the DOM.
By using the DOM, developers can create dynamic and interactive web pages.
JavaScript code can manipulate the DOM to respond to user actions, update content
dynamically, validate forms, create animations, modify styles, and perform other
operations to enhance the user experience on the web.
BootStrap
Bootstrap is a free and open-source front-end framework for developing websites
and web applications. It is one of the most popular frameworks in the world, used
by millions of developers to create responsive, mobile-first websites.
Bootstrap includes a number of features that make it a valuable tool for web
development, including:
Bootstrap is not a programming language, but it does use CSS, HTML, and
JavaScript. It is a framework that provides a set of tools and pre-written code that
one can use to speed up the development of your websites.
25
9. Lecture Notes – Advanced JavaScript
Create responsive websites: Bootstrap is built with a mobile-first approach, which
means that your websites will look good on all devices, from smartphones to
desktops.
Easy to use: Bootstrap is easy to learn and use, even for beginners. There are a
number of tutorials and resources available online to help one get started.
Large community: Bootstrap has a large and active community of developers who
are always willing to help. This means that one can get help with any problems one
encounter when using Bootstrap.
Here are some specific examples of Bootstrap components that one can use to build
these websites:
Grid system: Bootstrap's grid system is used to create responsive layouts that look
good on all devices.
Buttons: Bootstrap provides a variety of buttons that one can use to add interactivity
to your websites.
Forms: Bootstrap provides a number of form components that one can use to create
user-friendly forms.
Navigation bars: Bootstrap provides a variety of navigation bars that one can use to
help users navigate your websites.
Other components: Bootstrap provides a number of other components that one can
use to build your websites, such as images, tables, and alerts.
Variable
var carName;
26
9. Lecture Notes – Advanced JavaScript
This declares a variable called carName, but it doesn't have any value yet. To assign
a value to the variable, one use the equal sign:
carName = "Volvo";
Variables can be used to store any type of value, including numbers, strings,
objects, and arrays.
console.log(number); // 10
var object = {
age: 30,
};
27
9. Lecture Notes – Advanced JavaScript
console.log(object.age); // 30
console.log(array[0]); // 1
console.log(array[1]); // 2
console.log(array[2]); // 3
Variables can be used to store any type of value, and they can be used to perform
all sorts of calculations and operations. They are a fundamental part of JavaScript,
and they are essential for writing any kind of JavaScript program.
Here are some additional things to keep in mind about variables in JavaScript:
Variable names must start with a letter or underscore, and they can only contain
letters, numbers, and underscores.
Variable names are case-sensitive, so carName and CarName are different variables.
Variables are not declared in blocks, so they are accessible from anywhere in the
program.
var: This is the oldest type of variable in JavaScript. It is not recommended to use
var anymore, as it has some limitations. For example, var variables are not hoisted,
which means that they are not created until they are first used. This can lead to
errors if one try to access a var variable before it has been created.
28
9. Lecture Notes – Advanced JavaScript
let: Let variables are hoisted, which means that they are created when the variable
declaration is encountered, even if the variable is not used until later. This prevents
errors from occurring when one try to access a let variable before it has been
created. Let variables are also block-scoped, which means that they are only
accessible within the block in which they are declared. This prevents name collisions
from occurring between variables that are declared in different blocks.
const: Const variables are similar to let variables, but they cannot be changed after
they are declared. This makes const variables a good choice for variables that
should not be changed, such as constants. Const variables are also block-scoped.
for loop: The for loop is the most common type of loop in JavaScript. It is used to
repeat a block of code a specified number of times.
while loop: The while loop is used to repeat a block of code while a specified
condition is true.
do while loop: The do while loop is similar to the while loop, but it executes the
block of code once, even if the condition is false.
for...in loop: The for...in loop is used to iterate over the properties of an object.
Here is an example of a for loop that iterates over the numbers from 1 to 10:
console.log(i);
This loop will first set the variable i to 1. Then, it will check if i is less than or equal
to 10. If it is, the loop will execute the block of code, which in this case is just the
console.log() statement. The loop will then increment the value of i by 1 and check
the condition again. This will continue until i is greater than 10, at which point the
loop will exit.
29
9. Lecture Notes – Advanced JavaScript
Here is an example of a while loop that adds the numbers from 1 to 10:
var sum = 0;
var i = 1;
sum += i;
i++;
console.log(sum); // 55
This loop first sets the variables sum and i to 0 and 1, respectively. Then, it checks if
i is less than or equal to 10. If it is, the loop will add i to sum and increment the
value of i by 1. The loop will then check the condition again. This will continue until i
is greater than 10, at which point the loop will exit and the value of sum will be
logged to the console.
Here is an example of a do while loop that prints the message "Hello, world!" twice:
var counter = 0;
do {
console.log("Hello, world!");
counter++;
This loop first sets the variable counter to 0. Then, it prints the message "Hello,
world!" and increments the value of counter by 1. The loop will then check if
counter is less than 2. If it is, the loop will execute the block of code again. This will
continue until counter is equal to 2, at which point the loop will exit.
30
9. Lecture Notes – Advanced JavaScript
Here is an example of a for...in loop that iterates over the properties of an object:
var object = {
age: 30,
};
console.log(property);
Operators
Assignment operators: These operators are used to assign values to variables. For
example, the assignment operator (=) can be used to assign the value 10 to the
variable x.
Comparison operators: These operators are used to compare two values. For
example, the greater than operator (>) can be used to compare two numbers and
see if the first number is greater than the second number.
Logical operators: These operators are used to combine logical expressions. For
example, the logical AND operator (&&) can be used to combine two logical
expressions and see if both expressions are true.
31
9. Lecture Notes – Advanced JavaScript
String operators: These operators are used to manipulate strings. For example, the
concatenation operator (+) can be used to combine two strings together.
Scope
In JavaScript, the scope of a variable refers to the part of the program where the
variable can be accessed. There are three types of scopes in JavaScript:
Global scope: Variables declared outside of any function have global scope. This
means that the variable can be accessed from anywhere in the program.
Local scope: Variables declared inside a function have local scope. This means that
the variable can only be accessed from within the function in which it is declared.
function myFunction() {
myFunction();
In this example, the variable globalVariable has global scope. This means that it can
be accessed from anywhere in the program, including from within the function
myFunction().
32
9. Lecture Notes – Advanced JavaScript
Local scope:
function myFunction() {
myFunction();
In this example, the variable localVariable has local scope. This means that it can
only be accessed from within the function myFunction(). If one try to access
localVariable from outside of the function, one will get an error.
Block scope:
if (true) {
Arrays
Arrays are a fundamental data structure in JavaScript. They can be used to store a
collection of values, such as numbers, strings, and objects. Arrays are zero-indexed,
which means that the first element of an array has an index of 0.
This declares an array called array that contains the values 1, 2, 3, 4, and 5.
33
9. Lecture Notes – Advanced JavaScript
One can access the elements of an array by using their index. For example, to
access the value 3 in the array array, one would use the following code:
One can also add elements to an array using the push() method. The push()
method takes a value as its argument and adds it to the end of the array. For
example, the following code will add the value 6 to the array array:
array.push(6);
One can also remove elements from an array using the pop() method. The pop()
method removes the last element from the array and returns it. For example, the
following code will remove the last element from the array array and assign it to the
variable value:
One can also iterate over the elements of an array using a for loop. The following
code will iterate over the elements of the array array and print each element to the
console:
console.log(array[i]);
Here are some of the most common methods for working with arrays in JavaScript:
pop(): Removes the last element from an array and returns it.
shift(): Removes the first element from an array and returns it.
34
9. Lecture Notes – Advanced JavaScript
slice(): Returns a new array that contains a slice of the original array.
array.push(1);
array.push(2);
array.push(3);
console.log(array); // [1, 2, 3]
This code will first create an empty array called array. Then, it will use the push()
method to add the values 1, 2, and 3 to the array. Finally, it will print the array to
the console.
Here is an example of how to use the pop() method to remove an element from an
array:
console.log(array); // [1, 2]
console.log(value); // 3
This code will first create an array called array that contains the values 1, 2, and 3.
Then, it will use the pop() method to remove the last element from the array. The
value that is removed will be assigned to the variable value. Finally, the array and
the value will be printed to the console.
35
9. Lecture Notes – Advanced JavaScript
Here is an example of how to use the indexOf() method to find the index of a value
in an array:
console.log(index); //
This code will first create an array called array that contains the values 1, 2, 3, 4,
and 5. Then, it will use the indexOf() method to find the index of the value 3 in the
array. The index of the value 3 is 2, so the value 2 will be assigned to the variable
index. Finally, the index will be printed to the console.
Spread operator
The spread operator (...) is a new feature in JavaScript that was introduced in ES6.
It allows one to spread the elements of an array or iterable object into another array
or object.
Here is an example of how to use the spread operator to spread the elements of an
array into another array:
console.log(array3); // [1, 2, 3, 4, 5, 6]
console.log(array3); // [1, 2, 3, 4, 5, 6]
In the first code snippet, we use the concat() method to concatenate the two arrays
array1 and array2. This creates a new array called array3 that contains all of the
elements of array1 and array2.
36
9. Lecture Notes – Advanced JavaScript
In the second code snippet, we use the spread operator to spread the elements of
array1 and array2 into a new array called array3. This is the same result as using
the concat() method, but it is more concise and easier to read.
The spread operator can also be used to spread the elements of an iterable object
into an array or object. For example, the following code will spread the elements of
the object object into the array array:
var object = {
age: 30,
};
The spread operator is a powerful new feature in JavaScript that can be used to
write more concise and readable code. It is a valuable tool for anyone who is
working with arrays and iterable objects.
One can use the spread operator to create a new array that is a copy of an existing
array:
console.log(newArray); // [1, 2, 3]
37
9. Lecture Notes – Advanced JavaScript
var mergedArray = [...array1, ...array2];
console.log(mergedArray); // [1, 2, 3, 4, 5, 6]
One can use the spread operator to initialize an object with the properties of
another object:
var object1 = {
age: 30,
};
console.log(object2); // { name: "John Doe", age: 30, address: "123 Main Street,
Anytown, CA" }
One can use the spread operator to iterate over an array of objects:
var objects = [{ name: "John Doe", age: 30 }, { name: "Jane Doe", age: 25 }];
console.log(object.name);
// John Doe
// Jane Doe
The spread operator can be used in many different ways to make your JavaScript
code more concise and readable.
REST
RESTful APIs are a popular way to expose data and functionality to other
applications. REST stands for Representational State Transfer, and it is a set of
architectural principles that define how web services should interact with each other.
38
9. Lecture Notes – Advanced JavaScript
JavaScript is a powerful language that can be used to create RESTful APIs. There
are a number of libraries and frameworks that can help one to create RESTful APIs
in JavaScript, such as Express, Axios, and Superagent.
res.json([
]);
});
app.listen(3000, () => {
});
This code defines a simple RESTful API that exposes a /users endpoint. The /users
endpoint returns a JSON array of users.
To use this API, one can use a tool like Postman to make a GET request to the
/users endpoint. The response will be a JSON array of users.
RESTful APIs are a powerful way to expose data and functionality to other
applications. JavaScript is a great language for creating RESTful APIs, and there are
a number of libraries and frameworks that can help one to get started.
The first line imports the express library. Express is a popular web framework for
Node.js that makes it easy to create RESTful APIs.
39
9. Lecture Notes – Advanced JavaScript
The next line creates an Express application. The application is assigned to the
variable app.
The third line defines a route for the /users endpoint. The get method defines a GET
request handler. The handler function takes two arguments: req and res. req is an
object that contains information about the request, such as the headers and the
body. res is an object that is used to send the response.
The handler function in this example simply returns a JSON array of users. The
JSON array is created using the JSON.stringify() method.
The fifth line logs a message to the console when the server starts.
This is a very simple example of a RESTful API. However, it shows the basic
concepts of RESTful APIs. RESTful APIs are based on the following principles:
Resources: Resources are the nouns in your API. For example, a user resource
might represent a user in your database.
URIs: URIs are used to identify resources. For example, the URI /users might
identify the users resource.
HTTP methods: HTTP methods are used to perform actions on resources. The most
common HTTP methods are GET, POST, PUT, and DELETE.
DeStructuring
Destructuring is a JavaScript feature that allows one to extract the values from an
object or array into individual variables. This can be useful for making your code
more concise and readable.
Here is an example of how to use destructuring to extract the values from an object:
40
9. Lecture Notes – Advanced JavaScript
const user = {
age: 30,
};
console.log(age); // 30
In this example, we use the destructuring syntax to extract the name and age
properties from the object user. The name and age properties are assigned to the
variables name and age respectively.
Here is another example of how to use destructuring to extract the values from an
array:
console.log(first); // 1
console.log(second); // 2
console.log(third); // 3
In this example, we use the destructuring syntax to extract the first three elements
from the array numbers. The first three elements are assigned to the variables first,
second, and third respectively.
Destructuring is a powerful feature that can be used to make your JavaScript code
more concise and readable. It is a valuable tool for anyone who is writing JavaScript
code.
41
9. Lecture Notes – Advanced JavaScript
Destructuring can be used to extract any number of values from an object or array.
The values that are extracted are assigned to variables in the order that they are
declared.
The variables that are used to store the extracted values do not need to have the
same names as the properties or elements that are being extracted.
Destructuring can be used to extract multiple elements from an array in a single line
of code.
Destructuring is a powerful feature that can be used to make your JavaScript code
more concise and readable. It is a valuable tool for anyone who is writing JavaScript
code.
One can use destructuring to extract all of the properties from an object:
const user = {
age: 30,
};
One can use destructuring to extract a subset of the properties from an object:
const user = {
42
9. Lecture Notes – Advanced JavaScript
age: 30,
};
One can use destructuring to extract all of the elements from an array:
One can use destructuring to extract a subset of the elements from an array:
Destructuring is a powerful feature that can be used to make JavaScript code more
concise and readable. It is a valuable tool for anyone who is writing JavaScript code.
43
10. ASSIGNMENT – 1 To 5
Type 1:
1. Basics of JavaScript:
❑ Create a simple webpage using HTML5, CSS3, and JavaScript.
❑ Add a form to collect user information (Name, Email, and Age).
❑ Use JavaScript to validate the form inputs and display error messages
for invalid entries.
2. DOM Manipulation:
❑ Create a JavaScript program to display a list of items dynamically on the
webpage.
❑ Allow users to add, update, and remove items from the list using buttons.
Type 2:
1. JavaScript Objects:
Write a program to create a Bank Account Object with attributes: customer name,
account type, balance, date of creation, bank name, branch name, and PAN card
number.
❑ Use JavaScript methods to:
❑ Add a new account.
❑ List all account details.
44
10. ASSIGNMENT – 1 To 5
Type 3:
1. De-structuring and Scope:
❑ Create a nested object for a library system (attributes: library name, location, list of
books, and list of members). Use object de-structuring to extract and print individual
properties.
❑ Demonstrate the difference between var, let, and const for declaring variables within
different scopes.
2. Bootstrap and Responsive Design:
Design a responsive webpage using Bootstrap for a mock "Banking Services" page.
❑ Include a navigation bar, a services section, and a customer feedback form.
❑ Use Media Queries to make it mobile-friendly.
Type 4:
1. Advanced JavaScript Concepts:
Develop a JavaScript program to calculate the average balance of all customers in a
bank.
❑ Use an array of objects where each object contains account details.
❑ Implement Array.map() and Array.reduce() to perform the calculation.
45
10. ASSIGNMENT – 1 To 5
Type 5:
1. Complex Object Operations:
Build a banking application using JavaScript.
❑ Include features like adding customer details, updating balances, and checking
transaction history.
❑ Use Object.keys(), Object.values(), and Object.entries() to list, retrieve, and
manage customer data.
46
11. PART A : Questions & Answers
1. What is the purpose of HTML5 in web development?
HTML5 provides the structure for web pages and supports multimedia elements like audio
and video without additional plugins. (CO1,K1)
2. What are Media Queries in CSS3? (CO1,K1)
Media Queries allow developers to apply CSS rules based on device characteristics like
screen size or resolution.
3. What are the different types of JavaScript operators? (CO1,K1)
JavaScript operators include arithmetic, comparison, logical, assignment, and bitwise
operators.
4. Define Hoisting in JavaScript. (CO1,K1)
Hoisting is a behavior where variable and function declarations are moved to the top of
their scope during compilation.
5. What is a JavaScript Object? (CO2,K1)
A JavaScript object is a collection of key-value pairs used to store multiple values.
6. What is the purpose of the Spread Operator in JavaScript? (CO1,K1)
The Spread Operator allows copying or merging arrays/objects or spreading values into
function arguments.
7. Explain the concept of Scope in JavaScript. (CO1,K2)
Scope determines the accessibility of variables—global or local—within the code.
8. How is REST Parameter different from Spread Operator? (CO1,K2)
REST Parameter gathers arguments into an array, while the Spread Operator expands an
array into individual elements
9. What is the significance of Bootstrap in web development? (CO1,K2)
Bootstrap is a framework for creating responsive and mobile-first websites using pre-
styled components.
10. How does Destructuring work in JavaScript? (CO2,K2)
Destructuring extracts properties from objects or elements from arrays and assigns them
to variables.
47
11. PART A : Questions & Answers
11. Write a simple use case for using Hoisting in JavaScript. (CO1,K3)
Declaring a function before its actual usage ensures cleaner code and better readability.
12. How can you check the existence of a key in a JavaScript object? (CO2,K3)
Use the in operator or hasOwnProperty() method to check if a key exists.
13. How can you merge two arrays using the Spread Operator? (CO2,K3)
Example: let merged = [...array1, ...array2];
14. Demonstrate variable declaration using let and const. (CO1,K3)
Example: let x = 5; const y = 10;—let is reassignable, const is not.
15. How do you dynamically add a new property to a JavaScript object?
(CO2,K3)
Use dot notation or bracket notation. Example: object.newKey = value;
16. How does Media Queries enhance responsive design? (CO1,K3)
Media Queries apply specific CSS rules based on the device's screen properties to improve
user experience.
17. What is the benefit of using Object.entries() in JavaScript? (CO1,K3)
It converts an object into an array of key-value pairs, making it easier to iterate through.
18. Compare var and let in terms of scope. (CO1,K3)
var is function-scoped, while let is block-scoped, reducing potential errors.
19. How does Destructuring improve code readability? (CO2,K3)
It simplifies extracting multiple properties from an object or elements from an array.
20. Why is Bootstrap preferred for responsive design? (CO1,K3)
Its pre-built components and grid system simplify creating layouts compatible with all
devices.
21. Write the importance of Hoisting in debugging. (CO1,K3)
Hoisting helps identify undefined variables or functions early in the program execution.
22.How can you determine if an object is empty in JavaScript? (CO2,K3)
Check if Object.keys(obj).length equals 0.
23. Assess the impact of using const over let. (CO1,K3)
Using const enforces immutability, enhancing code stability and predictability.
48
12. PART B QUESTIONS
1. Explain the key features of HTML5 and CSS3 that make them suitable
for modern web development. (CO1,K2)
4. Using the Spread Operator, demonstrate how to merge two arrays and
update the properties of an existing object in JavaScript. (CO2,K3)
6. Compare the usage of var, let, and const in JavaScript with respect to
scope, hoisting, and reassignment. Provide suitable examples. (CO1,K4)
49
12. PART B QUESTIONS : UNIT – I
12. Explain the difference between the Spread operator and the REST
operator in JavaScript with examples of their usage. (CO2,K2)
13. Write a JavaScript program to demonstrate how loops (for, while, do-
while) can be used to iterate over an array of customer bank accounts.
(CO1,K3)
15. Design and implement a responsive webpage using Media Queries and
Bootstrap that displays customer account information dynamically loaded
from a JavaScript object. (CO1, CO2,K6)
50
13. SUPPORTIVE ONLINE CERTIFICATION COURSES
https://infosysspringboard.ausnz.onwingspan.com/en/app/toc/l
ex_18109698366332810000_shared/overview
https://www.coursera.org/learn/website-coding
https://www.udemy.com/course/web-design-for-beginners-
real-world-coding-in-html-css/
51
14. REAL TIME APPLICATIONS
1) A WEB APPLICATION PROVIDING RANGE OF OPTIONS TO CAR BUYERS
Car selling website is where the customer can buy and sell their car. This website is
user friendly and ease to use for any customer, it has effective search box to get the
precise and suitable car for the user. A rich search facility is always there from where
customer can search vehicle via category, keywords, price range, brand, types, fuel
types, etc. The website displays information of the customer support person on the
homepage so that user can directly contact them or meet them which help in
decreasing the communication gap. This website also provides a facility for road side
assistance. The social media plugin will help the company to know their popularity over
the social media.
This application is developed for users who are interested in playing fantasy sports
online. Users can play fantasy sports with close friends or people you met over the
internet. Users can create their own leagues and can invite friends to play in their
league or they can play in others leagues. Users can easily change the league size,
payment deadlines, payout verifications and payout timelines. This system guarantee
the professional safekeeping of the funds through full-featured security measures.
User can withdraw funds from their account. User can refer a friend to play a particular
league.
Responsive web design is a way of making a single website that works effectively on
both desktop browsers and the myriad of mobile devices on the market. It involves
having a website that enhances the viewing experience, irrespective of which device is
being used. Bootstrap makes the front-end web development faster and easier. It is
made for the users of all skill levels, devices of all shapes and projects of all sizes. It is
considered the most popular HTML, CSS, and JavaScript framework for developing
responsive & mobile-first websites. With a responsive website design,
52
14. REAL TIME APPLICATIONS
Not to worry about having different websites for various devices or making sure that
your website runs properly on a mobile device.
At Spaculus, we can incorporate your new website design or we modify it and make it
responsive if you already own a website. Our team of experts uses various tools and
technologies to make your website more accessible such as media queries, flexible grid
based layouts that use re-sizing and flexible images & media.
4) Navigating the Internet
Storage of data in the browser was tedious in the past. For a user to save the data of
the browser that persists between two sessions, the user’s cookies or infrastructure is
to be built from the server end. This process has now been eased with
HTML5. HTML5 has roped in new features. Such storage features are localStorage and
IndexDB.
To Remove – localStorage.removeItem(“username”);
15. CONTENT BEYOND SYLLABUS
Composing Functions in Functional Programming
Function composition in JavaScript is a technique where the output of one function
becomes the input of another, enabling the chaining of functions. This simplifies
complex workflows by breaking them into smaller, reusable, and testable units. It
aligns with the principle of modularity, making code cleaner and easier to maintain.
Implementation: Reusable Pipeline for User Data Processing
Scenario:
Suppose we have user data, and we need to:
1. Normalize the user's name (convert to lowercase).
2. Filter out users under a specific age.
3. Format the data for display.
Code Example:
// Individual processing functions
const normalizeName = (user) => ({ ...user, name: user.name.toLowerCase() });
const filterByAge = (ageLimit) => (user) => user.age >= ageLimit;
const formatForDisplay = (user) => `${user.name} (${user.age} years old)`;
// Function composition utility
const compose = (...functions) => (data) => functions.reduce((result, func) =>
func(result), data);
// Sample pipeline for user data processing
const processUserData = compose( normalizeName, filterByAge(18),
formatForDisplay);
// Example usage
const user = { name: "John Doe", age: 20 };
const processedUser = processUserData(user);
console.log(processedUser); // Output: "john doe (20 years old)“
Modularity: Each function handles a specific part of the workflow, improving code
clarity.
Reusability: Functions like filterByAge and normalizeName can be reused in other
pipelines.
Flexibility: The compose utility allows chaining any combination of functions, making
the pipeline highly adaptable to different workflows. 54
15. ASSESSMENT SCHEDULE
Name of the
S.NO Start Date End Date Portion
Assessment
As per schedule after
1 Unit Test 1 UNIT 1
Unit I completion
2 IAT 1 28.01.2025 03.02.2025 UNIT 1 & 2
163
55
16. PRESCRIBED TEXT BOOKS
&
REFERENCE BOOKS
TEXT BOOKS:
1. Andy Harris, “HTML5 and CSS3 All-in-One For Dummies Book”, 3rd Edition, 2014.
2. David McFarland, “JavaScript and JQuery: Interactive Front-End Web
Development”.
REFERENCES:
2. Deitel, Deitel, Goldberg, "Internet and World Wide Web How To Program",
3. Marty Hall and Larry Brown, “Core Web Programming”, Pearson Education,
5. https://www.w3schools.com/js/js_es6.asp
6. http://es6-features.org/
7. https://www.tutorialspoint.com/es6/index.htm
56
17. MINI PROJECT – 1 to 5
Type 1:
Create a static website for a "Customer Feedback Portal" for a
bank.
❑ Use HTML5, CSS3, and basic JavaScript to collect feedback (name,
email, and comments).
Type 2:
Type 3:
57
17. MINI PROJECT – 1 to 5
Type 4:
Type 5:
Create a fully functional Online Banking System.
58
Thank you
Disclaimer:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document through
email in error, please notify the system manager. This document contains
proprietary information and is intended only to the respective group / learning
community as intended. If you are not the addressee you should not disseminate,
distribute or copy through e-mail. Please notify the sender immediately by e-mail if
you have received this document by mistake and delete this document from your
system. If you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of this
information is strictly prohibited.
59