web 2nd interbnal
web 2nd interbnal
• An array is a special variable, which can hold more than one value:
or
Array Methods
Array length
Array toString()
Array at()
Array join()
Array pop()
Array push()
Array shift()
Array unshift()
Array delete()
Array concat()
what is function
A function in JavaScript is a reusable block of code that performs a specific task or computes
a value. Functions allow you to organize and structure your code, making it modular and
reusable.
Variables in JS
• JavaScript variables must have unique names. These
names are called Identifiers.
• Basic rules to declare a variable in JavaScript:
• These are case-sensitive
• Can only begin with a letter, underscore(“_”) or “$”
symbol
• It can contain letters, numbers, underscore, or “$”
symbol
• A variable name cannot be a reserved keyword.
• Js variable are let,var,const
• The var statement declares function-scoped or globally-
scoped variables, optionally initializing each to a value.
• Var a=10;
• The let keyword is used to declare variables in
JavaScript. It is similar to the var keyword, but there are
some differences in how they work. When you use the
let keyword to declare a variable, the variable is block-
scoped. This means that it is only accessible within the
block of code where it is defined.
• Let a=10;
• The const declaration declares block-scoped local
variables. The value of a constant can't be changed
through reassignment using the assignment operator,
but if a constant is an object, its properties can be
added, updated, or removed.
• Const a=10;
what is loop
In JavaScript, a loop is a way to execute a block of code repeatedly. Common types of loops
in JavaScript include:
for
while
do...while
for...of
for...in
js switch case
In JavaScript, a switch statement is a control structure used to evaluate an expression and
execute a block of code based on matching case values. It is an alternative to using multiple
if...else conditions and can make the code cleaner when there are several conditions to
evaluate.
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
jS Popup Boxes
In JavaScript, popup boxes are used to interact with users, provide information, or get input.
There are three primary types of popup boxes:
1. Alert Box
Displays a simple message to the user with an "OK" button
2. Confirm Box
Asks for user confirmation with "OK" and "Cancel" buttons.
Returns:
o true if the user clicks "OK"
o false if the user clicks "Cancel"
3. Prompt Box
js events
n JavaScript, events are actions or occurrences that happen in the browser, such as a user clicking a
button, submitting a form, or hovering over an element. Events allow you to create interactive web
pages by responding to these actions.
Event Description
click Fired when an element is clicked.
mouseover Triggered when the mouse hovers over an element.
mouseout Triggered when the mouse moves out of an element.
keydown Fired when a key is pressed on the keyboard.
keyup Fired when a pressed key is released.
load Triggered when the webpage or an element (like an image) finishes loading.
submit Fired when a form is submitted.
focus Fired when an element (like an input field) gains focus.
blur Fired when an element loses focus.
change Triggered when the value of an input, select, or textarea changes.
resize Triggered when the browser window is resized.
scroll Fired when the user scrolls the page or an element.
dblclick Fired when an element is double-clicked.
contextmenu Fired when the right mouse button is clicked (opens the context menu).
Js comments
• JavaScript comments can be used to explain JavaScript
code, and to make it more readable.
• Single Line Comments
• Single line comments start with //.
• Multi-line Comments
• Multi-line comments start with /* and end with */.
Any text between /* and */ will be ignored by JavaScript.
What is object?
• JavaScript is designed on a simple object-based
paradigm. An object is a collection of properties, and a
property is an association between a name (or key) and
a value. A property's value can be a function, in which
case the property is known as a method.
• const person1 = {
firstName: "John",
lastName: "Doe",
age: 50,
eyeColor: "blue"
};
• Object.entries(person1);
What is css and type of css
CSS (Cascading Style Sheets) is a stylesheet language used to control the presentation and
layout of web pages. It allows you to define styles (e.g., colors, fonts, spacing) for HTML
elements and ensures consistency across your website. CSS separates content (HTML) from
design, making web development more efficient.
Types of CSS
1. Inline CSS
Styles are applied directly to an HTML element using the style attribute
2. Internal CSS
Styles are defined within a <style> tag inside the <head> section of the HTML document
3. External CSS
Styles are defined in a separate .css file and linked to the HTML document using the
<link> tag.
Syntax
selector {
color: value;
1. Named Colors
2. Hexadecimal Colors
Colors are represented by a # followed by six hexadecimal digits (RRGGBB) or three (RGB).
Define colors using the RGB model with values ranging from 0 to 255
CSS Box Model
The CSS Box Model is a fundamental concept that describes how HTML elements are
structured and spaced on a web page. Every element in CSS is treated as a rectangular box,
consisting of the following components:
1. Content:
o The actual content inside the box, such as text, images, or other elements.
o Controlled using properties like width and height.
2. Padding:
o Space between the content and the border.
o Adds breathing room inside the box.
o Controlled using padding property.
3. Border:
o The line that surrounds the padding (or content, if padding is not defined).
o Controlled using border properties like border-width, border-style, and
border-color.
4. Margin:
o Space between the element's border and surrounding elements.
o Creates separation between elements.
o Controlled using margin property.
Hyperlinks in HTML
A hyperlink (or link) is an element in a webpage that allows you to navigate from one page
or resource to another. In HTML, hyperlinks are created using the <a> (anchor) tag.
Hyperlinks are fundamental to the structure of the web, as they connect different pages and
resources.
In HTML, a list is used to group a set of related items. There are two primary types of lists:
html
Copy code
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
html
Copy code
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
html
Copy code
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>
1. Static Websites
Static websites are websites whose content remains fixed or the same for all visitors. The
information on a static website does not change unless manually updated by the website
owner or developer
Use Cases:
Personal portfolios
Small business websites
Brochure-style websites
Landing pages
2. Dynamic Websites
Dynamic websites are websites whose content is generated or updated in real-time, based on
user interaction or other factors. The content changes depending on user inputs, preferences,
or external data.
Use Cases:
W3C
W3C stands for the World Wide Web Consortium. It is an international community that
works to develop open standards and guidelines to ensure the long-term growth and
accessibility of the web.
what is hosting
Web hosting is the service that allows individuals and organizations to make their websites
accessible on the internet. When you create a website, all of its files (such as HTML, CSS,
images, videos, and scripts) need to be stored on a server so that users can access the site via
a web browser. Web hosting providers supply the technology and infrastructure to store these
files and deliver them to users when they visit your website.
Shared Hosting:
Dedicated Hosting:
Cloud Hosting:
Reseller Hosting
what is domain
A domain (or domain name) is the human-readable address used to identify and access a
website on the internet. It acts as a unique identifier that directs users to the website's hosting
server, where the website's content is stored. Without domain names, you would have to use
complex IP addresses (numbers like 192.168.1.1) to access websites, which would be
difficult to rememb
In HTML and CSS, elements can be classified into two main categories based on how they
behave within a web page's layout: block-level elements and inline elements. Understanding
the difference between these two types is essential for controlling the layout of a webpage.
1. Block-Level Elements
A block-level element is an element that occupies the entire width available to it (by default)
and starts on a new line. It essentially creates a "block" of content.
2. Inline Elements
An inline element only takes up as much width as necessary for its content and does not start
on a new line. It flows inline with the surrounding content, meaning that it appears on the
same line as other inline elements and te
Form in html
In HTML, a form is an element that allows users to input data and submit it to a server for
processing. Forms are essential for collecting user information such as login details, contact
information, or payment details. They are the backbone of interactive websites, enabling
features like registration, search, and feedback submission.
The <form> element is used to define a form on a webpage. It can contain various types of
input elements such as text fields, checkboxes, radio buttons, and submit buttons.
Data typer in js
In JavaScript, a data type defines the type of data a variable can hold. Understanding the different
data types is essential for manipulating and storing data correctly in your programs. JavaScript has
several built-in data types, and they can be broadly categorized into primitive types and non-
primitive types.