Web Application Development Notes
Web Application Development Notes
Key Features:
Key Features:
3. JavaScript
Definition: JavaScript is a high-level, dynamic, and interpreted
programming language that enables interactivity on web pages.
Key Features:
Event Handling: JavaScript can listen for user actions (like clicks,
keystrokes, etc.) and execute code in response to those events.
Diagram
Hereʼs a simple Mermaid diagram to visualize the relationship between HTML5,
CSS, and JavaScript:
graph TD;
A[Web Development] --> B[HTML5]
A --> C[CSS]
A --> D[JavaScript]
HTML5
Feature Description
<!DOCTYPE>
<html>
<head>
<title>Web page title</title>
</head>
4. Key Components
1. Tags: Enclosed in angle brackets (< >), tags define elements (e.g., for
headings, for paragraphs).
6. HTML Comments
To create a comment in HTML, you use the following syntax:
Important Table:
<html>
The root element of an <html lang="en">...</html>
HTML page.
Contains meta-
<head><title>Page Title</title>
<head> information about the </head>
document.
Provides metadata
<meta> such as character set <meta charset="UTF-8">
and keywords.
Links to external
<link rel="stylesheet"
<link> resources, like href="styles.css">
stylesheets.
document.
important.
<p> Defines a paragraph. <p>This is a paragraph.</p>
<a href="
<a> Creates a hyperlink. <https://example.com>">Link</a>
<img src="image.jpg"
<img> Embeds an image. alt="Description">
<ol> ).
<table><tr><td>Cell</td></tr>
<table> Creates a table. </table>
Defines a row in a
<tr> <tr><td>Row 1</td></tr>
table.
Other Tags:
Tag Description Example
Represents introductory
<header><h1>Title</h1>
<header> content or navigational </header>
links.
Represents content
<aside><p>Related Info</p>
<aside> indirectly related to the </aside>
main content.
<video controls><source
Embeds a video file in the src="video.mp4"
<video>
document. type="video/mp4"></video>
<canvas id="myCanvas"
<canvas>
Used for drawing graphics width="200" height="100">
on the web page. </canvas>
CSS
1. What is CSS?
CSS stands for Cascading Style Sheets, a stylesheet language used to
describe the presentation of a document written in HTML or XML. CSS controls
layout, colors, fonts, and overall visual aesthetics and is an essential part of
modern web design.
Types of CSS:
1. Inline CSS
Definition: Styles applied directly in the HTML element using the
attribute.
Usage:
2. Internal CSS
Definition: Styles defined within a tag in the document's .
Usage:
<style>
p { color: red; }
</style>
3. External CSS
Definition: Styles written in a separate file linked to the HTML
document.
Usage:
/* This is a
multi-line comment */
Examples
1. Single-Line Comment:
body {
background-color: lightgrey; /* Set background color
*/
}
2. Multi-Line Comment:
a:hover {
text-decoration: underline; /* Underline on hover */
}
CSS Selectors
Targets elements in a
Pseudo-class Selector a:hover { color: red; }
specific state.
CSS Colors
A six-digit code
Hexadecimal #ff5733 (Orange)
representing RGB values.
Important Table
CSS Property Description Example
color
Sets the text color of an color: red;
element.
background-color
Sets the background background-color:
color of an element. #f0f0f0;
font-size
Sets the size of the text font-size: 16px;
font.
font-family
Sets the font family for font-family: Arial,
an element's text. sans-serif;
font-weight
Sets the thickness of the font-weight: bold;
font (boldness).
center).
line-height
Sets the height of a line line-height: 1.5;
box.
element.
element.
border
Sets the border around border: 1px solid
an element. black;
width
Sets the width of an width: 100%;
element.
Specifies how an
display element is displayed display: block;
an element.
Offsets an element
top , right , bottom , left relative to its normal top: 10px;
A shorthand property to
set the flex-grow, flex-
flex flex: 1;
shrink, and flex-basis
properties.
an element's box.
Javascript
Definition
JavaScript (JS) is a high-level, dynamic, and interpreted programming
language primarily used for enhancing web pages and creating interactive web
applications. It is object based scripting language.
Key Concepts
Concept Description
Variable Declaration
Keyword Scope Reassignment
var Function/global Yes
let Block Yes
const Block No
1. Data Types
Data Type Description Example
Represents a sequence of
String let str = "Hello";
characters.
2. Operators
Operator Type Description Example
subtraction, etc.).
Type Operators
Arithmetic + , - , * , / , % , ++ , --
Assignment = , += , -= , *= , /= , %= , ++ , --
3. Functions
Type Description Example
function greet() { return
Function Declaration Defines a named function. "Hello"; }
Immediately Invoked
A function that runs as (function() {
Function Expression console.log("IIFE"); })();
soon as it is defined.
(IIFE)
4. Control Flow
Statement Description Example
if Executes a block of code if if (x > 10) { ... }
a specified condition is
5. Object-Oriented Programming
Concept Description Example
class Car {
Class
A blueprint for creating constructor(model) {
objects. this.model = model; } }
A mechanism to create a
class Dog extends Animal {
Inheritance new class from an existing ... }
class.
person.sayHello =
Method
A function that is a function() { return
property of an object. "Hello"; };
6. Asynchronous Programming
Concept Description Example
Calls a function
setInterval(() => {
repeatedly, with a fixed
setInterval console.log("Hello every
time delay between each second"); }, 1000);
call.
7. Strings
Strings are sequences of characters.
Method Description
length Returns the length of the string.
JavaScript Cookies
A cookie is an amount of information that persists between a server-side and a
client-side. A web browser stores this information at the time of browsing.
So, to recognize the old user, we need to add the cookie with the response
from the server.
Now, whenever a user sends a request to the server, the cookie is added
with that request automatically. Due to the cookie, the server recognizes
the users.
The default object of browser is window means you can call all the functions of
window by specifying window or directly. For example:
window.alert("hello javatpoint");
is same as:
alert("hello javatpoint");
alert() , prompt() ,
Main browser
window setTimeout() , location ,
window/tab object
document
navigator.userAgent ,
navigator Browser and OS info navigator.language ,
navigator.onLine
location.href ,
Current URL, navigation
location location.reload() ,
control
location.assign()
history.back() ,
history Browser history control history.forward() ,
history.go()
console.log() ,
console Logs and debugging console.error() ,
console.clear()
getElementById() ,
Access elements based
Selectors getElementsByClassName() ,
on selectors
querySelector()
style.property ,
Change element styles
CSS Manipulation classList.add() ,
dynamically
classList.remove()
Adds interactivity by
addEventListener() , onclick ,
Event Handling responding to user
onmouseover
actions
getAttribute() ,
Manage element
Attributes setAttribute() ,
attributes
removeAttribute()
DOM Example
Exception Handling
JavaScript uses , , and blocks for error handling.
Usage Description
try Wraps code to test for errors.
try {
// Code that may throw an error
} catch (error) {
// Handle error
} finally {
// Always executes
}
Errors in Javascript:
C) HyperText Multi-language
A)
B)
C)
D)
A) <style> tag
B) <script> tag
C) <css> tag
D) <design> tag
A)
B)
C)
D)
A) String
B) Number
C) Boolean
D) Character
A) text-color
B) color
C) font-color
D) text-style
A) styles
B) class
C) style
D) css
Answers
1. A) HyperText Markup Language
2. B)
4. A)
5. C)
6. D) Character
8. B) color
HTTP/HTTPS
Definition
HTTP (Hypertext Transfer Protocol) is a protocol used for transferring data
over the web. It facilitates communication between clients (such as web
browsers) and servers.
HTTPS (HTTP Secure) is the secure version of HTTP, using SSL/TLS to encrypt
the data exchanged between the browser and the web server, ensuring
confidentiality and integrity.
B) HTTPS uses encryption (SSL/TLS) for security, while HTTP does not.
C) HTTPS is used only for APIs, while HTTP is for web pages.
A) 21
B) 25
C) 80
D) 443
A) FTP
B) SSH
C) SSL/TLS
D) Telnet
A) Secure
B) System
D) Simple
A) API Key
B) Security Token
C) SSL/TLS Certificate
D) Authentication Token
A) SQL Injection
B) Man-in-the-Middle Attacks
2. B) HTTPS uses encryption (SSL/TLS) for security, while HTTP does not.
3. C) 80
4. C) SSL/TLS
5. A) Secure
7. C) SSL/TLS Certificate
8. B) Man-in-the-Middle Attacks
3. Server interacts with the database using JSP, PHP, Servlet, ASP.net etc.
4. Data is retrieved.
Key Features
Feature Description
Example: Waiting in line at a coffee shop. You wait for the person ahead to
finish before ordering.
Example: Waiting in line at a coffee shop. You wait for the person ahead to
finish before ordering.
Asynchronous (Async)
Example: Ordering food at a restaurant. You place your order and continue with
other activities while waiting for your food.
Example: Ordering food at a restaurant. You place your order and continue
with other activities while waiting for your food.
Key differences
Blocking Yes No
JS vs AJAX
Feature JavaScript (JS) AJAX
Always asynchronous,
Synchronous vs. Can be both synchronous
promoting a seamless user
Asynchronous and asynchronous.
experience.
No specific format
Commonly uses JSON and
Supported Formats requirement (text, HTML,
XML for data exchange.
DOM manipulation).
Summary
JavaScript is a fundamental programming language used for web development,
while AJAX is a technique built on JavaScript that enables asynchronous data
exchange with a server, enhancing the user experience.
A) HTML
B) JavaScript
C) SQL
D) XMLHttpRequest
A) load()
B) open()
C) send()
D) request()
A) initialize()
B) start()
C) open()
D) begin()
Answers
1. A) Asynchronous JavaScript and XML
2. C) SQL
6. C) send()
9. C) open()
HTTP Methods:
Updates an existing
PUT resource or creates it if it PUT /api/items/1
doesn't exist.
Advantages
Scalable: Can grow easily with traffic.
Quick Example
Request:
Response:
{
"id": 12345,
"name": "John Doe",
"email": "john@example.com"
}
REST VS HTTP:
REST is an architectural style for designing networked applications that use
HTTP as a protocol for communication, focusing on resource manipulation
and statelessness.
2. Which HTTP method is typically used to retrieve data from a RESTful API?
A) POST
B) GET
C) PUT
D) DELETE
C) To manage databases
A) Statelessness
B) Client-Server Architecture
C) Multiple protocols
5. What does the status code 404 indicate in a REST API response?
A) OK
B) Created
C) Not Found
D) Unauthorized
A) PUT
B) POST
C) GET
D) DELETE
A) APIs
B) URLs
C) Methods
D) Headers
8. What does the status code 200 indicate in a REST API response?
A) Created
B) No Content
C) OK
D) Bad Request
B) JSON
C) CSV
D) Both A and B
Answers
1. A) Representational State Transfer
2. B) GET
4. C) Multiple protocols
5. C) Not Found
6. B) POST
7. B) URLs
8. C) OK
9. D) Both A and B
Cookies
Definition
Cookies are small pieces of data stored by the web browser that provide a way
for websites to remember information about the user.
Key Features
Feature Description
Cookie Example
Setting a cookie in JavaScript:
Retrieving a cookie:
A) A piece of software
C) A type of malware
D) A server-side technology
C) Personalizing content
B) 1 year maximum
C) Indefinitely
A) Max-Age
B)
C)
D) Both A and B
6. Which HTTP header is used to send cookies from the server to the client?
A) Set-Cookie
B) Cookie
C) Content-Type
D) User-Agent
D) Both A and B
9. How can a user view and delete cookies stored in their browser?
Answers
4. D) Both A and B
6. A) Set-Cookie
7. D) Both A and B
Combining changes
Merging feature1 into main after it's
Merge from one branch into
finished.
another.
A request to review
and add code Asking to merge feature1 into main
Pull Request
changes from one on GitHub.
branch.
git clone
Copying a repository
Clone <https://github.com/user/repo.git >
to your computer.
makes a copy locally.
Sending your
After committing, use git push to
Push changes to a remote
upload your changes.
repository.
A place to prepare
Use git add filename to add changes
Staging Area changes before
to the staging area.
saving them.
A version of your
origin is the default name for your
Remote project on a server
remote repo.
like GitHub.
A personal copy of
You can fork a project on GitHub to
Fork someone else's
make your own changes.
repository.
Level Description
Command Description
git init Initializes a new Git repository.
GitHub is a proprietary
Git is open-source
Ownership service but offers free
software.
repositories.
Multiple-Choice Questions
1. What is Git?
C) A programming language
D) A text editor
A) git start
B) git new
C) git init
D) git create
D) To switch branches
A) System
B) Global
C) Local
D) Default
6. What command would you use to merge changes from a branch called
“featureˮ into the current branch?
C) Compiling code
D) Debugging applications
D) A compiled program
9. Which of the following commands is used to view the status of files in the
working directory?
A) git status
B) git check
C) git log
D) git overview
Answers
1. B) A distributed version control system
2. C) git init
5. D) Default
9. A) git status