0% found this document useful (0 votes)
20 views11 pages

web 2nd interbnal

Uploaded by

avni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views11 pages

web 2nd interbnal

Uploaded by

avni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

JS Arrays, working with Arrays

• An array is a special variable, which can hold more than one value:

• Type of array is object in js

• const array_name = [item1, item2, ...]

or

const cars = new Array("Saab", "Volvo", "BMW");

Accessing Array Elements

const cars = ["Saab", "Volvo", "BMW"];


let car = cars[0];

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.

• A JavaScript function is executed when "something" invokes it (calls it).


• function myFunction(p1, p2) {
return p1 * p2;
}
• When JavaScript reaches a return statement, the function will stop executing.

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

 Allows the user to input a value.


 Returns:
o The input text if the user clicks "OK"
o null if the user clicks "Cancel"

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.

Common JavaScript Events

Here’s a list of frequently used events:

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

There are three main 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.

css color property


The color property in CSS is used to set the text color of an HTML element. It applies to the
text content of elements and can be defined using various color formats.

Syntax

selector {

color: value;

CSS supports several ways to define colors:

1. Named Colors

Predefined color names, such as red, blue, or green

2. Hexadecimal Colors

Colors are represented by a # followed by six hexadecimal digits (RRGGBB) or three (RGB).

 Full Hex: #ff0000 (Red)


 Short Hex: #f00 (Red)

3. RGB (Red, Green, Blue)

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:

Components of the Box Model

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:

1. Unordered List (<ul>):


o This is a list where the order of items doesn't matter. The items are usually
displayed with bullet points.
o Example:

html
Copy code
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>

2. Ordered List (<ol>):


o This is a list where the order of items matters, and the items are numbered or
lettered.
o Example:

html
Copy code
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>

3. Description List (<dl>):


o This is a list of terms and their descriptions. It consists of pairs of <dt>
(description term) and <dd> (description details).
o Example:

html
Copy code
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>

what is table in html


In HTML, a table is used to display data in a structured, tabular format. It is created using a
combination of various tags that define the table structure, rows, and cells.

Here’s a breakdown of the key elements used to create a table in HTML:

1. <table>: The main container element for the entire table.


2. <tr> (Table Row): Defines a row within the table.
3. <th> (Table Header): Defines a header cell, typically used to label columns or rows.
Text inside a <th> tag is bold and centered by default.
4. <td> (Table Data): Defines a regular cell in the table that contains data.
5. <thead>, <tbody>, and <tfoot>: These optional elements are used to group the
header, body, and footer sections of a table, respectively.

Types of Websites (Static and Dynamic Websites)


Websites can generally be categorized into two main types: Static Websites and Dynamic
Websites. Each type has distinct features and uses, depending on the requirements of the
website and its content.

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:

 E-commerce websites (e.g., Amazon, eBay)


 Social media platforms (e.g., Facebook, Twitter)
 Blogs and news sites (e.g., WordPress-based blogs)
 Content management systems (CMS)
 Forums or discussion boards

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.

Types of Web Hosting:

Shared Hosting:

VPS Hosting (Virtual Private Server):

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

what is block and inline element

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.

Common Block-Level Elements:

 <div> – A generic container used for grouping content.


 <p> – Represents a paragraph.
 <h1>, <h2>, <h3>, <h4>, <h5>, <h6> – Header tags, used for headings.
 <ul>, <ol>, <li> – List elements.

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

Common Inline Elements:

 <a> – Defines a hyperlink.


 <span> – A generic inline container, often used for styling.
 <strong>, <em> – Text formatting elements for emphasis or importance.
 <img> – Embeds an image.

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.

HTML <form> Element

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy