Skip to content

Commit 3b793fc

Browse files
committed
Fixed All issues
1 parent a1fa889 commit 3b793fc

8 files changed

Lines changed: 295 additions & 8 deletions

File tree

absolute-beginners/full-stack/css/box-model.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Use these for more control:
6464

6565
## 4. The "Box-Sizing" Problem
6666

67-
By default, if you give a box a width of `200px` and then add `20px` of padding, the box actually becomes **240px** wide ($200 + 20 \text{ left} + 20 \text{ right}$). This often breaks layouts!
67+
By default, if you give a box a width of `200px` and then add `20px` of padding, the box actually becomes **240px** wide (200 + 20 \text{ left} + 20 \text{ right}). This often breaks layouts!
6868

6969
### The Fix: `border-box`
7070

absolute-beginners/full-stack/css/grid.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ Here is how you build a professional website structure in just a few lines of CS
9191
}
9292

9393
header { grid-column: 1 / 3; }
94-
nav { grid-row: 2 / 3; }
95-
main { grid-row: 2 / 3; }
94+
nav { grid-column: 1 / 2; grid-row: 2 / 3; }
95+
main { grid-column: 2 / 3; grid-row: 2 / 3; }
9696
footer { grid-column: 1 / 3; }
9797
```
9898

absolute-beginners/full-stack/html/forms.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ graph LR
7676
<label>Choose a City:</label>
7777
<select name="city">
7878
<option value="indore">Indore</option>
79-
<option value="mhopal">Bhopal</option>
79+
<option value="bhopal">Bhopal</option>
8080
<option value="mumbai">Mumbai</option>
8181
</select>
8282
```

absolute-beginners/full-stack/internet-basics/browsers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The browser combines the DOM and the CSSOM into a **Render Tree**.
8888
</TabItem>
8989
<TabItem value="layout" label="4. Layout (Reflow)">
9090

91-
Now the browser knows *what* to show, it needs to know **where** to show it. The **Layout** stage calculates the exact exact coordinates and size (width, height) of every element on the screen.
91+
Now the browser knows *what* to show, it needs to know **where** to show it. The **Layout** stage calculates the exact coordinates and size (width, height) of every element on the screen.
9292

9393
*This stage is re-run (called a **Reflow**) whenever you resize the window or change an element's size with JavaScript.*
9494

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"label": "JavaScript",
3+
"position": 5,
4+
"link": {
5+
"type": "generated-index",
6+
"title": "JavaScript: The Logic of the Web",
7+
"description": "JavaScript is the programming language that brings your web pages to life. While HTML provides structure and CSS provides style, JavaScript adds the brain—allowing you to create interactive features, handle data, and build complex applications."
8+
}
9+
}
Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,104 @@
1-
<ComingSoon />
1+
---
2+
title: "JavaScript Functions"
3+
sidebar_label: "3. Functions"
4+
sidebar_position: 3
5+
description: "Learn how to write reusable blocks of code to make your programs efficient."
6+
---
7+
8+
Imagine you are a chef. Instead of writing down the steps to bake a cake every single time someone orders one, you just write the recipe once and give it a name: **"BakeCake"**. Whenever you need a cake, you just follow that named recipe.
9+
10+
In JavaScript, a **Function** is a reusable block of code designed to perform a particular task.
11+
12+
## 1. How to Define a Function
13+
14+
Creating a function is like building a machine. It has three main parts:
15+
16+
1. **Declaration:** Using the `function` keyword.
17+
2. **Name:** A descriptive name (using camelCase).
18+
3. **Parameters:** Values you "feed" into the machine (inside the parentheses `()`).
19+
4. **Body:** The actual code inside the curly braces `{}`.
20+
21+
```javascript
22+
function sayHello(name) {
23+
console.log("Hello " + name + "! Welcome to CodeHarborHub.");
24+
}
25+
```
26+
27+
## 2. Calling (Using) a Function
28+
29+
Defining a function doesn't run the code inside. To use the machine, you must **"Call"** it by using its name followed by parentheses.
30+
31+
```javascript
32+
// Calling the function
33+
sayHello("Ajay");
34+
// Output: Hello Ajay! Welcome to CodeHarborHub.
35+
36+
sayHello("Student");
37+
// Output: Hello Student! Welcome to CodeHarborHub.
38+
```
39+
40+
## 3. Return Values
41+
42+
Sometimes, you don't just want a function to print a message; you want it to **give you something back** (like a calculator giving you the result of a sum). We use the `return` keyword for this.
43+
44+
```javascript
45+
function addNumbers(a, b) {
46+
return a + b; // Sends the result back to whoever called it
47+
}
48+
49+
let result = addNumbers(5, 10);
50+
console.log(result); // Output: 15
51+
```
52+
53+
:::warning The Return Rule
54+
Once a function hits a `return` statement, it stops immediately. Any code written *after* the return inside that function will be ignored.
55+
:::
56+
57+
## 4. Parameters vs. Arguments
58+
59+
These terms are often confused, but the difference is simple:
60+
61+
* **Parameters:** The "placeholders" listed in the function definition (e.g., `a` and `b`).
62+
* **Arguments:** The "real values" you pass to the function when you call it (e.g., `5` and `10`).
63+
64+
## 5. Arrow Functions (The Modern Way)
65+
66+
In modern JavaScript (ES6+), developers use a shorter syntax called **Arrow Functions**. It's the "cool" way to write functions at **CodeHarborHub**.
67+
68+
<Tabs>
69+
<TabItem value="traditional" label="Traditional" default>
70+
```js
71+
function multiply(x, y) {
72+
return x * y;
73+
}
74+
```
75+
</TabItem>
76+
<TabItem value="arrow" label="Arrow Function">
77+
```js
78+
const multiply = (x, y) => x * y;
79+
```
80+
81+
<em>(If it's just one line, you don't even need the "return" keyword!)</em>
82+
83+
</TabItem>
84+
</Tabs>
85+
86+
## Practice: The "Tip Calculator"
87+
88+
Try building this reusable tool in your `script.js`:
89+
90+
```javascript
91+
function calculateTip(billAmount, tipPercentage) {
92+
let tip = billAmount * (tipPercentage / 100);
93+
let total = billAmount + tip;
94+
return "Your total bill is: " + total;
95+
}
96+
97+
// Testing our machine
98+
console.log(calculateTip(100, 15)); // Output: Your total bill is: 115
99+
console.log(calculateTip(250, 10)); // Output: Your total bill is: 275
100+
```
101+
102+
:::info Keep it Simple
103+
A good function should do **one thing** and do it well. If your function is doing 5 different tasks, it's better to break it into 5 smaller functions!
104+
:::
Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,83 @@
1-
<ComingSoon />
1+
---
2+
title: "Introduction to JavaScript"
3+
sidebar_label: "1. Introduction"
4+
sidebar_position: 1
5+
description: "Learn what JavaScript is and how it adds interactivity to your websites."
6+
---
7+
8+
If HTML is the **skeleton** and CSS is the **skin**, then **JavaScript (JS)** is the **brain**.
9+
10+
JavaScript is what makes a website *do* things. It handles what happens when you click a button, how data is saved, and how information updates without refreshing the whole page.
11+
12+
## 1. The Three Layers of a Web Page
13+
14+
To be a Full-Stack developer, you must understand how these three work together:
15+
16+
1. **HTML (Structure):** "There is a button here."
17+
2. **CSS (Style):** "The button is blue and rounded."
18+
3. **JavaScript (Logic):** "When the button is clicked, show a 'Thank You' message."
19+
20+
## 2. Where Does JavaScript Live?
21+
22+
Like CSS, you can add JavaScript to your project in different ways. At **CodeHarborHub**, we always recommend the **External** method to keep your "brain" separate from your "body."
23+
24+
<Tabs>
25+
<TabItem value="external" label="External (Recommended)" default>
26+
Create a file named <code>script.js</code>.
27+
<br/>
28+
<strong>In your HTML (at the bottom of &lt;body&gt;):</strong> `script src="script.js"></script>`
29+
</TabItem>
30+
<TabItem value="internal" label="Internal">
31+
Write code inside `<script>` tags.
32+
<br/>
33+
<strong>In your HTML:</strong> `<script> alert('Hello!'); </script>`
34+
</TabItem>
35+
</Tabs>
36+
37+
## 3. Your First Commands
38+
39+
JavaScript is a language of instructions. Here are the three most common ways to see if your "brain" is working:
40+
41+
1. **`console.log()`**: Prints a message in the browser's hidden "Developer Console." This is for developers to test things.
42+
2. **`alert()`**: Pops up a message box for the user.
43+
3. **`prompt()`**: Asks the user to type something in.
44+
45+
```javascript
46+
console.log("Welcome to CodeHarborHub!");
47+
alert("Warning: Learning JS is addictive!");
48+
```
49+
50+
## 4. The Developer Console
51+
52+
Every browser has a secret tool for developers.
53+
1. Right-click any website.
54+
2. Click **Inspect**.
55+
3. Click the **Console** tab.
56+
57+
You can actually type JavaScript directly into this console and it will run instantly!
58+
59+
## Let's Try It!
60+
61+
1. Open your project folder.
62+
2. Create a file named `index.html` and a file named `script.js`.
63+
3. Link them in your HTML:
64+
```html title="index.html"
65+
<body>
66+
<h1>My JS Test</h1>
67+
<script src="script.js"></script>
68+
</body>
69+
```
70+
4. In `script.js`, type:
71+
```javascript title="script.js"
72+
alert("JavaScript is connected!");
73+
console.log("I am a future Full-Stack Developer.");
74+
```
75+
5. Open your HTML in the browser. If the popup appears, you've just written your first script!
76+
77+
:::tip Why learn JS?
78+
JavaScript is the most popular programming language in the world. Once you learn it for the web, you can use it to build mobile apps, desktop software, and even control robots!
79+
:::
80+
81+
:::info Placement
82+
Always put your `<script>` tag at the very **bottom** of your `<body>`. This ensures your HTML (the skeleton) loads before the JavaScript (the brain) starts trying to control it.
83+
:::
Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,94 @@
1-
<ComingSoon />
1+
---
2+
title: "JavaScript Variables"
3+
sidebar_label: "2. Variables"
4+
sidebar_position: 2
5+
description: "Learn how to store and manage data using let and const in JavaScript."
6+
---
7+
8+
In programming, a **Variable** is a container for storing data values. Imagine you are moving into a new house; you put your things into boxes and put a label on each box so you know what's inside.
9+
10+
Variables work exactly like that!
11+
12+
## 1. How to Create a Variable
13+
14+
To create (or "declare") a variable in JavaScript, we follow a simple pattern:
15+
16+
```javascript
17+
let name = "Ajay";
18+
```
19+
20+
* **`let`**: The keyword that tells the computer we are creating a variable.
21+
* **`name`**: The unique name of the box (the label).
22+
* **`=`**: The assignment operator (it puts the value into the box).
23+
* **`"Ajay"`**: The actual data being stored.
24+
25+
## 2. `let` vs `const`
26+
27+
In modern JavaScript, we have two main ways to create variables. The choice depends on whether the value will change later.
28+
29+
<Tabs>
30+
<TabItem value="let" label="let (Changeable)" default>
31+
Use `let` when the value of the variable <strong>will change</strong> later in your program.
32+
33+
```js
34+
let score = 0;
35+
score = 10; // This is allowed!
36+
```
37+
38+
</TabItem>
39+
<TabItem value="const" label="const (Constant)">
40+
Use `const` when the value <strong>should never change</strong>. It stands for "Constant."
41+
42+
```js
43+
const birthYear = 2000;
44+
birthYear = 2005; // ❌ ERROR! You cannot change a constant.
45+
```
46+
</TabItem>
47+
</Tabs>
48+
49+
## 3. Rules for Naming Variables
50+
51+
You can't just name your variables anything. JavaScript has a few strict rules:
52+
53+
1. **No Spaces:** Use `userAge`, not `user age`.
54+
2. **Camel Case:** In JS, we start the first word with a lowercase letter and every word after with a Capital (e.g., `isUserLoggedIn`).
55+
3. **Start with Letters:** Names cannot start with a number.
56+
4. **Meaningful Names:** Don't use `let x = "Apple"`. Instead, use `let fruit = "Apple"`. It makes your code easier to read!
57+
58+
## 4. Using Variables
59+
60+
Once you store a value, you can use the variable name instead of the value itself.
61+
62+
```javascript
63+
let city = "Mandsaur";
64+
console.log("I live in " + city);
65+
// Output: I live in Mandsaur
66+
67+
city = "Indore";
68+
console.log("Now I live in " + city);
69+
// Output: Now I live in Indore
70+
```
71+
72+
## Let's Practice: The Greeting Script
73+
74+
Try writing this in your `script.js`:
75+
76+
1. Create a variable called `developerName` and store your name in it.
77+
2. Create a variable called `totalProjects` and store a number (like `5`).
78+
3. Use `console.log` to print a message combining both.
79+
80+
```javascript
81+
const developerName = "A Master"; // Using const because your name doesn't change often
82+
let totalProjects = 3; // Using let because you will build more!
83+
84+
console.log("Hello, my name is " + developerName);
85+
console.log("I have built " + totalProjects + " projects.");
86+
```
87+
88+
:::info Always Default to Const
89+
Most professional developers use `const` for everything by default. They only switch to `let` if they realize they absolutely *need* to change the value later. This prevents bugs!
90+
:::
91+
92+
:::warning Note on `var`
93+
You might see some older tutorials using the keyword `var`. At **CodeHarborHub**, we avoid `var` because it is old and can cause strange bugs in your code. Stick to `let` and `const`!
94+
:::

0 commit comments

Comments
 (0)