Skip to content

Commit 7ea87af

Browse files
added
1 parent 082ce03 commit 7ea87af

File tree

24 files changed

+881
-0
lines changed

24 files changed

+881
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS Basics</title>
6+
<link rel="stylesheet" href="01_styles.css">
7+
</head>
8+
9+
<body>
10+
11+
<h2>JavaScript Basics</h2>
12+
<div>
13+
<h1 id="display"></h1>
14+
</div>
15+
16+
<script src="01_script.js"></script>
17+
</body>
18+
</html>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//Alert Box
2+
//alert("Welcome to JavaScript");
3+
4+
// confirm Box
5+
//confirm("Hello JavaScript");
6+
7+
//console log
8+
console.log('Good Morning JavaScript');
9+
10+
//Display date on the console
11+
var date = new Date();
12+
console.log(date);
13+
14+
// Display date on the web page using DOM
15+
document.querySelector('#display').textContent = date.toDateString();
16+
17+
// Reverse a String
18+
var str = "Good Morning";
19+
20+
function reverseStr(str) {
21+
var tempStr = '';
22+
for(var i=str.length-1; i>=0 ; i--){
23+
tempStr += str.charAt(i);
24+
}
25+
return tempStr;
26+
}
27+
var output = reverseStr(str);
28+
document.querySelector('#display').textContent = output;
29+
30+
// Palindrome Function
31+
function isPalindrome(str) {
32+
return str === reverseStr(str);
33+
}
34+
35+
str = 'radar';
36+
output = isPalindrome(str);
37+
console.log('is Palindrome : ' + output);
38+
document.querySelector('#display').textContent = output;
39+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body{
2+
margin: 0;
3+
font-family: "Comic Sans MS",sans-serif;
4+
}
5+
h2{
6+
background-color: lightsalmon;
7+
text-align: center;
8+
padding: 10px;
9+
}
10+
div{
11+
background-color: orange;
12+
padding: 10px;
13+
text-align: center;
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Variable Declaration</title>
6+
<link rel="stylesheet" href="02_styles.css">
7+
</head>
8+
<body>
9+
10+
<h2>Variable Declaration Example</h2>
11+
<div>
12+
<h1 id="display"></h1>
13+
</div>
14+
15+
<script src="02_script.js"></script>
16+
</body>
17+
</html>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Create two variables and display their sum
2+
var a = 10;
3+
var b = 20;
4+
var sum = a + b;
5+
console.log('The Sum of ' + a + ' , ' + b + ' is ' + sum);
6+
7+
// Find the biggest value between 2 numbers
8+
var x = 10;
9+
var y = 20;
10+
if(x > y){
11+
console.log('The big value is : ' + x);
12+
}
13+
else{
14+
console.log('The big value is : ' + y);
15+
}
16+
17+
// Find the biggest value among 3 numbers
18+
var p = 10;
19+
var q = 20;
20+
var r = 30;
21+
if(p > q && p > r){
22+
console.log('The biggest value is : ' + p);
23+
}
24+
else if(q > r){
25+
console.log('The biggest value is : ' + q);
26+
}
27+
else{
28+
console.log('The biggest value is : ' + r);
29+
}
30+
31+
32+
// Good Morning Logic
33+
var time = 10;
34+
if(time <= 12){
35+
console.log('Good Morning');
36+
}
37+
else if(time >12 && time <= 17){
38+
console.log('Good Afternoon');
39+
}
40+
else if(time >17 && time <= 24){
41+
console.log('Good Evening');
42+
}
43+
else{
44+
console.log('Enter proper time');
45+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body{
2+
margin: 0;
3+
font-family: "Comic Sans MS",sans-serif;
4+
}
5+
h2{
6+
background-color: lightsalmon;
7+
text-align: center;
8+
padding: 10px;
9+
}
10+
div{
11+
background-color: orange;
12+
padding: 10px;
13+
text-align: center;
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS DataTypes</title>
6+
<link rel="stylesheet" href="03_styles.css">
7+
</head>
8+
9+
<body>
10+
11+
<h2>JS Data types Example</h2>
12+
<div>
13+
<h1 id="display"></h1>
14+
</div>
15+
16+
<script src="03_script.js"></script>
17+
</body>
18+
</html>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// number example
2+
var jsVersion = 5;
3+
console.log('value : ' + jsVersion + ' Datatype : ' + typeof jsVersion);
4+
5+
// String Examples
6+
var empName = 'John';
7+
console.log('value : ' + empName + ' Datatype : ' + typeof empName);
8+
9+
// boolean Examples
10+
var isJSEasy = true;
11+
console.log('value : ' + isJSEasy + ' Datatype : ' + typeof isJSEasy);
12+
13+
// reassignment example of variables
14+
var someVar;
15+
console.log('value : ' + someVar + ' Datatype : ' + typeof someVar);
16+
17+
someVar = 10;
18+
console.log('value : ' + someVar + ' Datatype : ' + typeof someVar);
19+
20+
someVar = 'test';
21+
console.log('value : ' + someVar + ' Datatype : ' + typeof someVar);
22+
23+
someVar = null;
24+
console.log('value : ' + someVar + ' Datatype : ' + typeof someVar);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body{
2+
margin: 0;
3+
font-family: "Comic Sans MS",sans-serif;
4+
}
5+
h2{
6+
background-color: lightsalmon;
7+
text-align: center;
8+
padding: 10px;
9+
}
10+
div{
11+
background-color: orange;
12+
padding: 10px;
13+
text-align: center;
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>JS Operators</title>
6+
<link rel="stylesheet" href="04_styles.css">
7+
</head>
8+
<body>
9+
10+
<h2>JS Operators Example</h2>
11+
<div>
12+
<h1 id="display"></h1>
13+
</div>
14+
15+
<script src="04_script.js"></script>
16+
</body>
17+
</html>

0 commit comments

Comments
 (0)