JavaScript
JavaScript
Day 1: Introduction to JavaScript
1. What is Java Script.
A JavaScript is the Web Based Programming Language. It is Used to calculate, manuplate and validate Data. It's also change the both HTML and CSS Codes.
2. History of JavaScript.
It was Developed By Brendan Eich at Netscape in the Year of 1995. JavaScript Was Originally Called Mocha --> LiveScript-->JavaScript.
In 1997 The NetScape will submitted the JavaScript to ECMA for International Standards so it will offically lunched as ECMAScript(ES). Now We use Moderan (ES6+) Version.
3. Uses of JavaScript.
1. Web Development (Front-End)
2. Web Development (Back-End)
3. Mobile Apps
4. Desktop Apps
5. Games Development
4. How its Works on Browser.
Many Browser Like (Edge, Chrome, Safari, ..., etc) have a in-built JavaScript Engine. In Chrome We have V8. The Js will works on following flow
1. parsing -> Broser will check the <script> tag and download the Js file.
2. Compile & Execution -> The JS Engine will compiles it into machine Executable code and run it.
3. DOM -> Js Modify the Document Objetct Model - and build a tree like structure for a web page that user wants to see.
5. Setup
No Need to install Special Softwares it free or open Source for all. just we need.
1. web Browser
2. Text Editor (NotePad, NotePad++, VS Code)
6. First Program
<html>
<head>
<title>Demo Page</title>
</head>
<body>
<script>
console.log("Hello World");
</script>
</body>
</html>
Day 2: Comments, variables, naming rules, primitive and non-primitive types, typeof
1. Comments
In JavaScript we have 2 types Comments. Those are as follow
1. Single Line Comment
// This Comment is used for single line titles of the program.
// This is a Single line Comment.
// We Can Place This Comments Any Where in the Program.
2. Multi Line Comment
/*
This is Multi-line Comment
If we explain the program in detail
we can use this Comments
*/
2. Variables
Variables is the name of the memory location. we have 4 types of variables.
1. var: It is used in older JavaScript Version Now it is not Recommended to use
2. let: If we declare the Variable useing let we can change it as any type.
3. const: If we declare the variable as const we can't change the value of the variable.
Eg: var a, let b, const c
3. Naming Variables
When Declaring the variable we start with alphabits or special symbol like (_), don't start with number or any other symbol
Example:
let apple
const banana
let apple1
const fruits_name
4. Primitive and non-Primitive Types:
one variable store multiple values.
object: let person1 = {
name:"DATTAPU PREM",
acc_no: 123456789,
ifcs: Karb0055484
};
Array: let numbers = [1, 2, 3, 4];
function: A function is a Block of code which can be execute any where in the program.
ex: function greeting()
{
console.log("Hello, World");
}
5. Typeof :
It is used to tell the what type of data will stored in the Variables.
Ex: let a = 12345;
console.log(typeof(a));
Day 3: Operators
Ex Structure :
<html>
<head>
<title></title>
</head>
<body>
<script>
let a = 10;
let b = 20;
console.log("Arithmetic Operators");
console.log(a + b);
console.log(a - b);
let x = 10;
console.log("Assignment Operators");
console.log(x += 5); // x = x + 5
let y = 10;
let z = "10";
console.log("Comparison Operators");
console.log(y == z);
console.log(y === z);
let age = 20;
console.log("Logical Operators");
console.log(age > 18 && age < 25);
console.log(age > 21 || age < 25);
</script>
</body>
</html>
Display the Text on the Web Page Using JavaScript:
Ex Structure:
<html>
<head>
<title></title>
</head>
<body>
<h1 id="one">1</h1>
<h1 id="two">2</h1>
<h1 id="three">3</h1>
<h1 id="one">1</h1>
<h1 id="two">2</h1>
<h1 id="three">3</h1>
<script>
document.getElementById("one").innerHTML = "Sai Teja";
document.getElementById("two").innerHTML = "Karun";
document.getElementById("one").innerHTML = "Vinay";
document.getElementById("two").innerHTML = "Rakesh";
</script>
</body>
</html>

Comments
Post a Comment