Skip to content

day 03 - added tasks and readme update #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 18, 2025
Merged
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Content-Slide.key
Content-Slide.key

.vscode
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
Learn 40 days of JavaScript on [tapaScript](https://youtube.com/tapasadhikary). It is to take you from the Beginner to an Expert JavaScript developer with al fundamentals and projects.

## 🫶 Support
Liked it? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.
Your support means a lot.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
- Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)

### 🤝 Sponsor My Work
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
Expand All @@ -15,6 +18,6 @@ I am an independent educator and open-source enthusiast who creates meaningful p

## Table of Content

- **`Day 1: Introduction to JavaScript & Setting Up the Environment`** - [Watch Video](https://youtu.be/t8QXF85YovE) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-01/README.md)
- **`Day 2: Variables (let, const, var) & Data Types`** - [Watch Video](https://www.youtube.com/watch?v=tVqy4Tw0i64) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-02/README.md)

- **`Day 01: Introduction to JavaScript & Setting Up the Environment`** - [Watch Video](https://youtu.be/t8QXF85YovE) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-01/README.md)
- **`Day 02: Variables (let, const, var) & Data Types`** - [Watch Video](https://www.youtube.com/watch?v=tVqy4Tw0i64) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-02/README.md)
- **`Day 03: Mater Operators and Expressions`** - [Watch Video](https://youtu.be/vI95K-_JLOw) || [Source Code](https://github.com/tapascript/40-days-of-javascript/blob/main/day-03/README.md)
7 changes: 5 additions & 2 deletions day-01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
- Task and How to Submit

## 🫶 Support
Liked it? It takes months of hard work to create quality content and present to you. You can show your support to me with a STAR(⭐) to this repository.
Your support means a lot.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
- Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)

### 🤝 Sponsor My Work
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
Expand Down
15 changes: 9 additions & 6 deletions day-02/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
- How JavaScript sees code?

## 🫶 Support
Liked it? It takes months of hard work to create quality content and present to you. You can show your support to me with a STAR(⭐) to this repository.
Your support means a lot.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)
- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
- Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)

### 🤝 Sponsor My Work
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.
Expand All @@ -23,7 +26,7 @@ Here is the video for you to go through and learn:

## **👩‍💻 🧑‍💻 Assignment Tasks**

✅ Task 1: Declare variables for a person’s name, age, isStudent status, and favorite programming language.
✅ Task 2: Print the values to the console.
✅ Task 3: Try reassigning values to let and const variables and observe errors.
✅ Task 4: Create an object and an array, assign them to new variables, modify, and observe changes.
- ✅ Task 1: Declare variables for a person’s name, age, isStudent status, and favorite programming language.
- ✅ Task 2: Print the values to the console.
- ✅ Task 3: Try reassigning values to let and const variables and observe errors.
- ✅ Task 4: Create an object and an array, assign them to new variables, modify, and observe changes.
37 changes: 37 additions & 0 deletions day-03/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Day 03 - 40 Days of JavaScript

## **🎯 Goal of This Lesson**

- What are Operands, Operators, Expressions?
- What are difefrent types of Operators?
- Arithmetic Operators
- Assignment Operators
- Comparison Operators
- Logical Operators
- Conditional Ternary Operator
- Bitwise Operator
- Relational Operator
- Grouping and Precedence
- typeof Operator
- instanceof Operator
- Tasks and Practices

## 🫶 Support
Your support means a lot.

- Please SUBSCRIBE to [tapaScript YouTube Channel](https://youtube.com/tapasadhikary) if not done already. A Big Thank You!
- Liked my work? It takes months of hard work to create quality content and present it to you. You can show your support to me with a STAR(⭐) to this repository.

> Many Thanks to all the `Stargazers` who have supported this project with stars(⭐)

### 🤝 Sponsor My Work
I am an independent educator and open-source enthusiast who creates meaningful projects to teach programming on my YouTube Channel. **You can support my work by [Sponsoring me on GitHub](https://github.com/sponsors/atapas) or [Buy Me a Cofee](https://buymeacoffee.com/tapasadhikary)**.

## Video
Here is the video for you to go through and learn:

[![day-03](./banner.png)](https://youtu.be/vI95K-_JLOw "Video")

## **👩‍💻 🧑‍💻 Assignment Tasks**

Please find the task assignments in the [Task File](./task.md).
Binary file added day-03/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions day-03/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Day 03</title>
<script defer src="./index.js"></script>
</head>
<body>
<h1>Welcome to the <u>Day 03</u> of "40 Days of JavaScript!"</h1>
</body>
</html>
178 changes: 178 additions & 0 deletions day-03/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
console.log("Day 03");

// Operator - Symbols + - * /
// Operands - x+y, x and y are the operands.
// Expression x = 2 / 3 + 4

// Arithmetic Operators
console.log("**** Arithmetic Operators ****")
let a = 12;
let b = 5;

let f_name = "tapas"
let l_name = "adhikary"

console.log(f_name + l_name) // don't do this!

console.log(a + b);
console.log(a - b);
console.log(b - a);
console.log(a * b);
console.log(a / b);
console.log(a ** b)
console.log(a % b)

let count = 5;
console.log(count--) // count = count - 1
console.log(count)

console.log(--count) // count = count - 1

// Assignment Operators
console.log("**** Assignment Operators ****")

let x = 10;
x += 5; // x = x + 5 (15)
x -=3; // x = x - 3 (12)
x *= 2; // x = x * 2 (24)
x /= 4; // x = x / 4 (6)


// Comparison Operators
console.log("**** Comparison Operators ****")
console.log(0 == false)
console.log(3 == '3')
console.log(3 != '3')

console.log(3 === '3')

console.log(null === null)
console.log(undefined === undefined)

// NaN = Not a Number

let obj1 = {'name': 'tapaScript'} // XX0011
let obj2 = {'name': 'tapaScript'} // YY022

console.log(obj1 === obj2)
console.log(obj1 !== obj2)

4 > 3
2 > 1
1 > 7
2 >= 2

4 < 3
2 < 7
3 <= 9


// Logical operators
console.log("**** Logical operators ****")
// && || ?? !
// op1 && op2
console.log(false && false); // false
console.log(true && false); // false
console.log(true && true); // true
console.log(false && true); // false

console.log("Cow" && "Horse"); // "Horse"

4 > 5 && 4 === 6

console.log(false || false); // false
console.log(true || false); // true
console.log(true || true); // true
console.log(false || true); // true

console.log("Cow" || "Horse"); // "Cow"

comsole.log(!false)

let a1 = null ?? 1; // 1
let a2 = undefined ?? 3 // 3
const a3 = false ?? "tapaScript" // false
const a4 = 0 ?? "tapas" // 0


// Conditional (ternary) operator
console.log("**** Conditional (ternary) operator ****")

// condition ? val1 : val2

let age = 23;
age >= 60 ? "Senior Citizen" : "Non Senior Citizen";


// Bitwise operators
console.log("**** Bitwise operators ****")

// 10 in decimal
// 10 in 32 bits representation of 0, 1

// & | ^ ~ << >>

15 & 9 = 9
1111 & 1001 = 1001 = 1 * (2 ** 0) + 0 * (2 ** 1) + 0 * (2 ** 2) + 1 * (2 ** 3)

15 / 2 = 7 (1)
7 / 2 = 3 (1)
3 / 2 = 1 (1)

9/2 = 4 (1)
4/2 = 2 (0)
2/2 = 1 (0)

15 | 9 = 15

1111 | 1001 = 1111

15 ^ 9 = 6
1111 ^ 1001 = 0110

9 << 2 = 36

1001 << 2 = 100100

9 >> 2 = 2
1001 >> 2 = 0010


// Grouiping
console.log("**** Grouping ****")

let p = 1;
let q = 2;
let r = 3;

console.log(p + q * r) // 1 + 2 * 3 = 1 + 6 = 7
p + (q * r) // 7

(p + q) * r // (1 + 2) * 3 = 3 * 3 = 9

p * r + q * r = 1 * 3 + 2 * 3 = 3 + 6 = 9

p * (r + q) * r


// typeof
console.log("**** typeof ****")


typeof "tapas"; // "string"
typeof false; // "boolean"

let size = 100;
typeof size; // "number"

const numbers = [1,2,3,4]
typeof numbers; // "object"

typeof null; // "object"


// instanceof
console.log("**** instanceof ****")

// object instanceof objectType

53 changes: 53 additions & 0 deletions day-03/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Tasks
Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".

> Please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.

## 1. Odd or Even?
- [ ] Take a number and find if the number is an odd or even number.
- [ ] Print the number and result in the console.

## 2. Do you have a Driving License?
Let's check if you are eligible to get a driving license. The eligibility to get a driving licence is 18 years.

- [ ] Manage `age` as a variable.
- [ ] Check if the age is elligible for a driving license and print it on the console accordingly.

## 3. Calculate CTC with a Bonus
Let's calculate how much you earn from your office.

- [ ] You get 12,300 rupees as your monthly salary.
- [ ] You get a 20% bonus on your annual salary.
- [ ] How much money do you make per annum as a CTC?

## 4. Write a program for the Traffic Light Simulation.
Red Light... Green Light... Let's Play!

- [ ] Create a `color` variable.
- [ ] Based on the color variable's value print in the console if a traveller needs to STOP or GO. The Red color is for STOP and the Green color is for GO.

## 5. Create an Electricity Bill Calculator
Let's calculate how much you pay for electricity bills per month and annually.

- [ ] Create a `units` variable. Based on this value you will calculate the total electricity bill for a months.
- [ ] If each day you consume the `units` and each unit cost 150 rupees, how much will you be charged per month?
- [ ] If there is a 20% discount on the annual payment, how much will you be charged for an annual payment?

## 6. Leap Year Checker
Is 2025 a Leap Year?

- [ ] Take `year` as input.
- [ ] Use the arithmetic operator and ternary operator to print if a year is a leap year or not.

## 7. Max of Three Numbers
Find the max number from the lot.

- [ ] Take three numbers and assign them to variables p, q, and r.
- [ ] Now find the maximum of these three numbers using the comparison operators.

## 8. Biwise Doubling
A tricky one for you

- [ ] Create a variable `count` and assign a value, say, 5.
- [ ] Now use the Bitwise shift operator to make the number double.
- [ ] Print it on the console.