Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
69 changes: 69 additions & 0 deletions css/advanced/Assignment-1/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
line-height: 1.6;
}

header {
background: #0d0a99;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The color #0d0a99 is hardcoded. For better maintainability and to ensure a consistent color scheme, it's recommended to define colors as CSS Custom Properties (variables) in a :root selector. This practice should be applied to all hardcoded colors in the file (e.g., on lines 41, 49, 56).

color: #fff;
padding: 20px;
text-align: center;
}

nav ul {
list-style: none;
display: flex;
justify-content: center;
gap: 20px;
margin-top: 10px;
}

nav a {
color: #fff;
text-decoration: none;
}

main {
display: flex;
padding: 20px;
gap: 20px;
}

article {
flex: 3;
background: #2c13a8;
color: #fff;
padding: 20px;
border-radius: 8px;
}

aside {
flex: 1;
background: #4d119b;
color: #fff;
padding: 20px;
border-radius: 8px;
}

footer {
background: #3f12ba;
color: #fff;
text-align: center;
padding: 15px;
margin-top: 20px;
bottom: auto;
}

@media (max-width: 768px) {
main {
flex-direction: column;
flex:1;
}
}
60 changes: 60 additions & 0 deletions css/advanced/Assignment-2/animations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Animation & Media Queries</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: #f0f0f0;
}
.box {
width: 150px;
height: 150px;
background: #3498db;
border-radius: 10px;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: bold;
animation: bounce 2s infinite;
}
@keyframes bounce {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-50px);
}
}
@media (max-width: 768px) {
.box {
width: 120px;
height: 120px;
font-size: 14px;
background: #e67e22;
}
}

@media (max-width: 480px) {
.box {
width: 90px;
height: 90px;
font-size: 12px;
background: #2ecc71;
}
}
</style>
Comment on lines +7 to +55
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The CSS styles are defined within a <style> tag in the HTML file. While this works for small examples, it goes against the best practice of separating concerns, which you've acknowledged in the PR description. Moving these styles to an external .css file improves modularity, reusability, and allows the browser to cache the stylesheet.

</head>
<body>
<div class="box">Hello Guys..!</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Inline, Internal & External JS Execution Order</title>
</head>
<body onload="document.getElementById('inline').innerHTML = 'Hello from Inline JS!'">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using the onload attribute for event handling is an outdated practice that mixes JavaScript logic with HTML markup. The PR description's best practices advise against this. A modern and cleaner approach is to use window.addEventListener('load', ...) within a script tag to separate concerns.


<h2>Execution Order Example</h2>
<p id="inline"></p>
<p id="internal"></p>
<p id="external"></p>

<script src="script.js"></script>


<script>
document.getElementById("internal").innnerHTML = "Hello from Internal JS!";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

There's a typo in innnerHTML; it should be innerHTML. This error will prevent the JavaScript from updating the element's content, causing a bug in the page's functionality.

Suggested change
document.getElementById("internal").innnerHTML = "Hello from Internal JS!";
document.getElementById("internal").innerHTML = "Hello from Internal JS!";

</script>

</body>
</html>
2 changes: 2 additions & 0 deletions javascript/2-vars-data-types/Assignment-1/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

document.getElementById("external").innerHTML = "Hello from External JS!";
38 changes: 38 additions & 0 deletions javascript/2-vars-data-types/Assignment-2/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
let output = "";
output += "<b>Using var:</b><br>";
var x = 10;
output += "Initial value: " + x + "<br>";
var x = 20;
output += "After redeclaration: " + x + "<br>";
x = 30;
output += "After reassignment: " + x + "<br><br>";

output += "<b>Using let:</b><br>";
let y = 10;
output += "Initial value: " + y + "<br>";
try {
let y = 20;
output += "After redeclaration: " + y + "<br>";
} catch (err) {
output += "Error on redeclaration: " + err.message + "<br>";
}
Comment on lines +13 to +18
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This try...catch block does not correctly demonstrate an error for redeclaring a variable with let. The let y = 20; inside the try block is in a new scope and does not conflict with the y on line 11. A SyntaxError for redeclaration occurs at parse time and cannot be caught by try...catch. This makes the demonstration misleading. The same logical flaw applies to the const redeclaration example on lines 25-30. To show this behavior, you could use commented-out code with an explanation of the error it would produce.

y = 30;
output += "After reassignment: " + y + "<br><br>";

output += "<b>Using const:</b><br>";
const z = 10;
output += "Initial value: " + z + "<br>";
try {
const z = 20;
output += "After redeclaration: " + z + "<br>";
} catch (err) {
output += "Error on redeclaration: " + err.message + "<br>";
}
try {
z = 30;
output += "After reassignment: " + z + "<br>";
} catch (err) {
output += "Error on reassignment: " + err.message + "<br>";
}

document.getElementById("output").innerHTML = output;
16 changes: 16 additions & 0 deletions javascript/2-vars-data-types/Assignment-2/var-let-const.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>var, let, const Example</title>
</head>
<body>

<h2>Variable Declaration, Redeclaration & Reassignment</h2>

<div id="output"></div>

<script src="script.js"></script>

</body>
</html>
29 changes: 29 additions & 0 deletions javascript/2-vars-data-types/Assignment-3/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
let output = "";
let name = "Sai Durga";
output += "Value: " + name + " — Type: " + typeof name + "<br>";

let age = 22;
output += "Value: " + age + " — Type: " + typeof age + "<br>";

let isStudent = true;
output += "Value: " + isStudent + " — Type: " + typeof isStudent + "<br>";

let city;
output += "Value: " + city + " — Type: " + typeof city + "<br>";

let car = null;
output +=
"Value: " +
car +
" — Type: " +
typeof car +
" (note: null is a special case)<br>";

let sym = Symbol("id");
output += "Value: " + sym.toString() + " — Type: " + typeof sym + "<br>";

let student = { name: "Sai", age: 25 };
output +=
"Value: " + JSON.stringify(student) + " — Type: " + typeof student + "<br>";

document.getElementById("output").innerHTML = output;
16 changes: 16 additions & 0 deletions javascript/2-vars-data-types/Assignment-3/typeof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript Data Types</title>
</head>
<body>

<h2>JavaScript Data Types and typeof</h2>

<div id="output"></div>

<script src="script.js"></script>

</body>
</html>
61 changes: 61 additions & 0 deletions javascript/2-vars-data-types/Assignment-4/typeconversion.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JavaScript Type Conversion</title>
</head>
<body>

<h2>JavaScript Type Conversion Example</h2>
<div id="output"></div>

<script>
let output = "";

let str = "123";
let num = 42;
let bool = true;
let undef;
let nul = null;
let sym = Symbol("id");
let obj = {name:"Sai"};

function convertAndPrint(value, typeName) {

let displayValue = (typeof value === "symbol") ? value.toString() : value;
output += `<b>${typeName} (${displayValue})</b><br>`;

try {
let n = Number(value);
output += "Number(): " + n + "<br>";
} catch(e) {
output += "Number(): Error - " + e.message + "<br>";
}

try {
let s = String(value);
output += "String(): " + s + "<br>";
} catch(e) {
output += "String(): Error - " + e.message + "<br>";
}

try {
let b = Boolean(value);
output += "Boolean(): " + b + "<br><br>";
} catch(e) {
output += "Boolean(): Error - " + e.message + "<br><br>";
}
}
convertAndPrint(str, "String");
convertAndPrint(num, "Number");
convertAndPrint(bool, "Boolean");
convertAndPrint(undef, "Undefined");
convertAndPrint(nul, "Null");
convertAndPrint(sym, "Symbol");
convertAndPrint(obj, "Object");

document.getElementById("output").innerHTML = output;
</script>
Comment on lines +12 to +58
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This HTML file contains a substantial amount of JavaScript. According to the best practices in the PR description, scripts should be in separate files to improve organization, maintainability, and enable caching. Please move this script to an external .js file. This feedback also applies to Assignment-5/typecorecion.html and Assignment-6/templateliterals.html.


</body>
</html>
42 changes: 42 additions & 0 deletions javascript/2-vars-data-types/Assignment-5/typecorecion.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Type Coercion Example</title>
</head>
<body>

<h2>JavaScript Type Coercion (Addition)</h2>
<div id="output"></div>

<script>
let output = "";

let str = "10";
let num = 5;
let bool = true;
let undef;
let nul = null;
let obj = {name:"Sai"};


function show(expr, result) {
output += expr + " → " + result + "<br>";
}

show(`${num} + ${str}`, num + str);
show(`${num} + ${bool}`, num + bool);
show(`${num} + ${undef}`, num + undef);
show(`${num} + ${nul}`, num + nul);
show(`${num} + ${obj}`, num + obj);

show(`${str} + ${bool}`, str + bool);
show(`${str} + ${nul}`, str + nul);
show(`${bool} + ${nul}`, bool + nul);
show(`${bool} + ${str}`, bool + str);

document.getElementById("output").innerHTML = output;
</script>

</body>
</html>
Loading