Frontend Notes
Frontend Notes
--------------
HTML,HTML 5
CSS,CSS3
- Bootstrap Framework
JavaScript
-jQuery Framework
Angular
---------------------------------------
Elements:
- elements can contain start and end tag.
- Element can create content in html page.
<html> </html>
<p> </p>
<span> </span>
Attribute:
- Attribute changes the behaviour of the element.
<p style="color:green" >My text document</p>
HTML 5 Introduction
-------------------
block elements takes full line and push the next element to next line
ex) table, p ,div, all new semantic elements
DAY 2
CSS- Cascadding Stylesheet
--------------------------
Its Used to change appearance of the element.
Syntax:
--------
Property_Name1: value1;
Property_Name2: value2;
Inline Stylesheet
-----------------
<div style=" " >
</div>
Embedded Stylesheet
-------------------
syntax:
----------
.class_name{ --- class selector
Property_Name1:value1;
Property_Name2:value2;
}
class vs id
-------------
Class can be used in mupltiple elements in page.
created with .
External Stylesheet
------------------
.css file is created with selector which will be applied in the page elements.
Day3:
-----
selectors - find the matching element and apply the mentioned styles to the
element.
BoxModel:
---------
Shorthand Notation-
-------------------
Width- MinWidth
---------------
Responsive WebDesign
----------------------
Developer Tools
-----------------
Explore - elements, Responsive view
DAY 4
Position :
---------
Placing element in webpage at mentioned location.
Postion:
static,
relative,
absoloute,
fixed,
sticky
Hiding an element
Display:none/block
Visiblity: hidden/Visible
Media Query
------------
decducts the screen size and apply new class styles
.mediaDiv{
background-color:blue;
}
background-color:red;
}
}
DAY 5
Display:
-------
flex is non dimensional
table
------
Display :grid is dimensional means ex: 2 X3
(0.1 to 0.9)
background-color:rgba(255,0,255, 0.4);
Its giving background color and opacity. 2 in 1.
CSS Gradients: - generates mixed colors
--------------
text-shadow
text-shadow: 2px 2px red;
box-shadow
box-shadow: 10px 10px lightblue;
Display
-------
inline
block
none
flex
grid
DAY 6
2D Transformation
-----------------
translate() - move an object to another position
rotate() -
scaleX() - make large size
scaleY()
scale()
skewX()
skewY()
skew()
matrix()
Style="text-transform:translate(20px,25px)";
3D Transformation
-----------------
rotateX(20deg);
rotateY(20deg);
rotateZ(20deg);
CSS Gradients: - generates mixed colors
--------------
text-shadow
text-shadow: 2px 2px red;
box-shadow
box-shadow: 10px 10px lightblue;
Bootstrap Framework
-------------------
DAY 7
BootStrap
---------
Layout building
container
container-fluid
DAY 8
What is JavaScript?
Scripting Language:
--------------------
JavaScript is a scripting language, meaning it's interpreted by a web browser line
by line, without needing to be compiled beforehand. This makes it quick and easy to
work with.
Client-Side:
------------
JavaScript primarily runs in the user's web browser (the "client-side"). This
allows it to manipulate web page content, respond to user actions (like clicks and
hovers), and update information without needing to constantly reload the page.
Dynamic:
---------
JavaScript enables you to create dynamic and interactive web experiences
Variables
-----------
All JavaScript variables must be identified with unique names.
unique names are called identifiers.
Names can contain letters, digits, underscores, and dollar signs.
Names must begin with a letter.
Names can also begin with _.
Names are case sensitive (y and Y are different variables).
Reserved words (like JavaScript keywords) cannot be used as names.
strings
---------
muthu
sathish
date
----
14-5-2025
boolean
--------
yes
no
number
-------
14500
25.35
implicit declarations.
Scope:
------
var
let
const
Global Scope: Variables declared outside any function or block have global scope.
They can be accessed and modified from anywhere in your code, including within
functions and blocks.
Function Scope: Variables declared inside a function have function scope. They are
only accessible within that specific function and are not visible outside of it.
Each function creates its own scope.
Block Scope: Variables declared using let or const inside a block (e.g., within
curly braces {} in an if statement, for loop, or any other block) have block scope.
They are only accessible within that specific block.
-------------------------------------------------------------------------
// Global scope
var globalVar = "I'm global";
function myFunction() {
// Function scope
var functionVar = "I'm in the function";
let blockVar = "I'm in the block";
if (true) {
// Block scope
let anotherBlockVar = "I'm in another block";
console.log(globalVar); // Accessible here
console.log(functionVar); // Accessible here
console.log(blockVar); // Accessible here
console.log(anotherBlockVar); // Accessible here
}
myFunction();
-------------------------------------------------------------------
--------------------------------------------------------------------
Data Types
-----------
JavaScript has several data types, which can be broadly categorized into primitive
(or value) types and non-primitive (or reference) types.
These data types are immutable, meaning their values cannot be changed directly.
When you reassign a primitive value, you're actually creating a new value in
memory.
These data types are mutable, meaning their values can be changed. When you work
with reference types, you're working with a reference (pointer) to the object in
memory, not the object itself.
JavaScript
let person = {
name: "Jane Doe",
age: 25,
city: "New York"
};
JavaScript
Function:
A block of code designed to perform a specific task.
Functions are first-class citizens in JavaScript, meaning they can be treated like
any other data type (e.g., passed as arguments to other functions, returned from
functions, assigned to variables).
JavaScript
function greet(name) {
return "Hello, " + name + "!";
}
Operators
---------
JavaScript has a wide variety of operators that allow you to perform various
operations on values (operands). Here's a breakdown of the common operator
categories:
1. Arithmetic Operators:
------------------------------
These operators perform mathematical calculations.
2. Assignment Operators:
------------------------
These operators assign values to variables.
= (Assignment): Assigns the value on the right to the variable on the left.
+= (Addition assignment): Adds the right operand to the left operand and assigns
the result to the left operand. (e.g., x += 5 is equivalent to x = x + 5)
-= (Subtraction assignment): Subtracts the right operand from the left operand and
assigns the result.
*= (Multiplication assignment): Multiplies the left operand by the right operand
and assigns the result.
/= (Division assignment): Divides the left operand by the right operand and assigns
the result.
%= (Remainder assignment): Calculates the remainder and assigns it to the left
operand.
3. Comparison Operators:
-------------------------
These operators compare two operands and return a boolean value (true or false).
== (Equal to): Checks if two operands are equal (loose equality). Type coercion may
occur.
=== (Strict equal to): Checks if two operands are equal and of the same type
(strict equality).
!= (Not equal to): Checks if two operands are not equal (loose inequality).
!== (Strict not equal to): Checks if two operands are not equal or not of the same
type (strict inequality).
> (Greater than): Checks if the left operand is greater than the right operand.
< (Less than): Checks if the left operand is less than the right operand.
>= (Greater than or equal to): Checks if the left operand is greater than or equal
to the right operand.
<= (Less than or equal to): Checks if the left operand is less than or equal to the
right operand.
4. Logical Operators:
----------------------
These operators perform logical operations on boolean values.
&& (Logical AND): Returns true if both operands are true, otherwise returns false.
|| (Logical OR): Returns true if at least one operand is true, otherwise returns
false.
! (Logical NOT): Returns the opposite boolean value of the operand.
6. String Operators:
----------------------
8. Type Operators:
------------------
typeof: Returns the data type of an operand (e.g., typeof 10 returns "number").
instanceof: Checks if an object is an instance of a particular class or constructor
function.
Operator Precedence:
--------------------
Operators have a specific order of precedence, which determines the order in which
they are evaluated in an expression. Parentheses () can be used to override the
default precedence.
Statements:
-----------
A program is essentially a sequence of statements. Every statement in JavaScript
is terminated by a semicolon (;). Although the semicolon is optional
Conditional Statements:
if -else
if statement:
if (condition) {
// Code to execute if the condition is true
}
else if statement:
if (condition1) {
// ...
} else if (condition2) {
// ...
} else {
// ...
}
if (condition1) {
// ...
} else if (condition2) {
// ...
} else {
// ...
}
swith:
switch statement: Used to select one block of code to execute from multiple blocks
based on a value.
switch (expression) {
case value1:
// ...
break;
case value2:
// ...
break;
default:
// ...
}
Loop Statements:
for loop:
while loop:
while (condition) {
// Code to be executed repeatedly
}
do...while loop:
do {
// Code to be executed repeatedly (at least once)
} while (condition);
Jump Statements:
These statements control the flow of execution within loops and other structures.
Functions:
-----------
functionName:
The name of the function. It should be descriptive and follow naming conventions.
implicit declarations.
Scope:
------
var
let
const
Global Scope: Variables declared outside any function or block have global scope.
They can be accessed and modified from anywhere in your code, including within
functions and blocks.
Function Scope: Variables declared inside a function have function scope. They are
only accessible within that specific function and are not visible outside of it.
Each function creates its own scope.
Block Scope: Variables declared using let or const inside a block (e.g., within
curly braces {} in an if statement, for loop, or any other block) have block scope.
They are only accessible within that specific block.
-------------------------------------------------------------------------
// Global scope
var globalVar = "I'm global";
function myFunction() {
// Function scope
var functionVar = "I'm in the function";
let blockVar = "I'm in the block";
if (true) {
// Block scope
let anotherBlockVar = "I'm in another block";
console.log(globalVar); // Accessible here
console.log(functionVar); // Accessible here
console.log(blockVar); // Accessible here
console.log(anotherBlockVar); // Accessible here
}
myFunction();
-----------------------------------------------------------------------------------
--------------
DAY 9
class
------
class is a blueprint for creating objects with shared properties and methods.
constructor
-----------
Its a special method which is called automatically when an object is created.
program:
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
greet() {
console.log(`Hello, my name is ${this.name}`);
}
}
Creating an Object
-------------------
Inheritance
------------
study() {
console.log(`${this.name} is studying.`);
}
}
Prototype
---------
Prototype is the mechanism by which JavaScript objects inherit features from one
another.
function Person(name) {
this.name = name;
}
Person.prototype.greet = function () {
console.log(`Hello, I'm ${this.name}`);
};
get and set are special methods that define how to access or update the value of an
object’s property.
class Person {
constructor(name) {
this._name = name;
}
get name() {
return this._name;
}
set name(value) {
this._name = value.toUpperCase();
}
}
function test()
{
Asynchrnous:
------------
setInterval
setTimeout(() => {
console.log("This runs after 2 seconds");
}, 2000);
Arrow function
--------------
()=>{}
inline function
function add(a,b)
{
return (a+b);
console.log(a+b)
}
()=>{ }
function show()
{
console.log("hello");
}
()=>{ console.log("hello")}
Promise Pattern
---------------
function myDisplayer(some) {
document.getElementById("demo").innerHTML = some;
}
if (x == 0) {
myResolve("OK");
} else {
myReject("Error");
}
});
myPromise.then(
function(value) {myDisplayer(value);},
function(error) {myDisplayer(error);}
);
JSON vs XML
------------
to store data.
no enviroment dependent.
common medium
JS Object
---------
{'name':'muthu,age:35};
XML Format:
----------
<Person>
<name>muthu</name>
<age>25</age>
</Person>
JSON Format
-----------
{name:'Muthu',
age:35}
// Retrieving data:
let text = localStorage.getItem("testJSON");
let obj = JSON.parse(text);
document.getElementById("demo").innerHTML = obj.name;
The HTML DOM (Document Object Model) is a programming interface that represents
the structure of an HTML document as a tree of objects.
It allows programming languages like JavaScript to access, modify, and interact
with the content and structure of a web page.
getElementById
getElementByClassName
getElementsByTagName
-----------------------------------------_-------------------------------
DAY 10
Promise Pattern
---------------
function myDisplayer(some) {
document.getElementById("demo").innerHTML = some;
}
if (x == 0) {
myResolve("OK");
} else {
myReject("Error");
}
});
myPromise.then(
function(value) {myDisplayer(value);},
function(error) {myDisplayer(error);}
);
The HTML DOM (Document Object Model) is a programming interface that represents
the structure of an HTML document as a tree of objects.
It allows programming languages like JavaScript to access, modify, and interact
with the content and structure of a web page.
getElementById
getElementByClassName
getElementsByTagName
innerHTML
innerText