Skip to content

Commit

Permalink
Merge pull request #1 from Asabeneh/master
Browse files Browse the repository at this point in the history
New pull request
  • Loading branch information
hammadCodes committed Jan 13, 2024
2 parents ff64df9 + 55d8e3d commit 838efcb
Show file tree
Hide file tree
Showing 436 changed files with 96,607 additions and 5,155 deletions.
18 changes: 9 additions & 9 deletions 01_Day_Introduction/01_day_starter/index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!DOCTYPE html>
<html>
<html lang="en">

<head>
<title>30DaysOfJavaScript</title>
<title>30DaysOfJavaScript</title>
</head>

<body>
<h1>30DaysOfJavaScript:03 Day</h1>
<h2>Introduction</h2>
<button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button>
<script src="./helloworld.js"></script>
<script src="./introduction.js"></script>
<script src="./varaible.js"></script>
<script src="./main.js"></script>
<h1>30DaysOfJavaScript:03 Day</h1>
<h2>Introduction</h2>
<button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button>
<script src="./helloworld.js"></script>
<script src="./introduction.js"></script>
<script src="./variable.js"></script>
<script src="./main.js"></script>

</body>

Expand Down
58 changes: 31 additions & 27 deletions 02_Day_Data_types/02_day_data_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@
![Thirty Days Of JavaScript](../images/banners/day_1_2.png)

- [📔 Day 2](#-day-2)
- [Data Types](#data-types)
- [Primitive Data Types](#primitive-data-types)
- [Non-Primitive Data Types](#non-primitive-data-types)
- [Numbers](#numbers)
- [Declaring Number Data Types](#declaring-number-data-types)
- [Math Object](#math-object)
- [Random Number Generator](#random-number-generator)
- [Strings](#strings)
- [String Concatenation](#string-concatenation)
- [Concatenating Using Addition Operator](#concatenating-using-addition-operator)
- [Long Literal Strings](#long-literal-strings)
- [Escape Sequences in Strings](#escape-sequences-in-strings)
- [Template Literals (Template Strings)](#template-literals-template-strings)
- [String Methods](#string-methods)
- [Checking Data Types and Casting](#checking-data-types-and-casting)
- [Checking Data Types](#checking-data-types)
- [Changing Data Type (Casting)](#changing-data-type-casting)
- [String to Int](#string-to-int)
- [String to Float](#string-to-float)
- [Float to Int](#float-to-int)
- [💻 Day 2: Exercises](#-day-2-exercises)
- [Exercise: Level 1](#exercise-level-1)
- [Exercise: Level 2](#exercise-level-2)
- [Exercises: Level 3](#exercises-level-3)
- [Data Types](#data-types)
- [Primitive Data Types](#primitive-data-types)
- [Non-Primitive Data Types](#non-primitive-data-types)
- [Numbers](#numbers)
- [Declaring Number Data Types](#declaring-number-data-types)
- [Math Object](#math-object)
- [Random Number Generator](#random-number-generator)
- [Strings](#strings)
- [String Concatenation](#string-concatenation)
- [Concatenating Using Addition Operator](#concatenating-using-addition-operator)
- [Long Literal Strings](#long-literal-strings)
- [Escape Sequences in Strings](#escape-sequences-in-strings)
- [Template Literals (Template Strings)](#template-literals-template-strings)
- [String Methods](#string-methods)
- [Checking Data Types and Casting](#checking-data-types-and-casting)
- [Checking Data Types](#checking-data-types)
- [Changing Data Type (Casting)](#changing-data-type-casting)
- [String to Int](#string-to-int)
- [String to Float](#string-to-float)
- [Float to Int](#float-to-int)
- [💻 Day 2: Exercises](#-day-2-exercises)
- [Exercise: Level 1](#exercise-level-1)
- [Exercise: Level 2](#exercise-level-2)
- [Exercises: Level 3](#exercises-level-3)

# 📔 Day 2

Expand All @@ -62,12 +62,12 @@ Primitive data types in JavaScript include:
3. Booleans - true or false value
4. Null - empty value or no value
5. Undefined - a declared variable without a value
6. Symbol - A unique value that can be generated by Symbol constructor

Non-primitive data types in JavaScript includes:

1. Objects
2. Functions
3. Arrays
2. Arrays

Now, let us see what exactly primitive and non-primitive data types mean.
*Primitive* data types are immutable(non-modifiable) data types. Once a primitive data type is created we cannot modify it.
Expand Down Expand Up @@ -231,6 +231,10 @@ console.log(Math.E) // 2.718
console.log(Math.log(2)) // 0.6931471805599453
console.log(Math.log(10)) // 2.302585092994046

// Returns the natural logarithm of 2 and 10 respectively
console.log(Math.LN2) // 0.6931471805599453
console.log(Math.LN10) // 2.302585092994046

// Trigonometry
Math.sin(0)
Math.sin(60)
Expand Down Expand Up @@ -876,7 +880,7 @@ console.log(numFloat) // 9.81
let num = '9.81'
let numFloat = +num
console.log(numInt) // 9.81
console.log(numFloat) // 9.81
```
#### Float to Int
Expand Down
2 changes: 1 addition & 1 deletion 02_Day_Data_types/02_day_starter/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">

<head>
<title>30DaysOfJavaScript</title>
Expand Down
2 changes: 1 addition & 1 deletion 02_Day_Data_types/string_methods/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let pattern = /love/gi
console.log(string.match(pattern)) // ["love", "love", "love"]
// Let us extract numbers from text using regular expression. This is not regular expression section, no panic.

let txt = 'In 2019, I run 30 Days of Pyhton. Now, in 2020 I super exited to start this challenge'
let txt = 'In 2019, I run 30 Days of Python. Now, in 2020 I super exited to start this challenge'
let regEx = /\d/g // d with escape character means d not a normal d instead acts a digit
// + means one or more digit numbers,
// if there is g after that it means global, search everywhere.
Expand Down
2 changes: 1 addition & 1 deletion 02_Day_Data_types/string_methods/split.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// split(): The split method splits a string at a specified place.
let string = '30 Days Of JavaScipt'
let string = '30 Days Of JavaScript'
console.log(string.split()) // ["30 Days Of JavaScript"]
console.log(string.split(' ')) // ["30", "Days", "Of", "JavaScript"]
let firstName = 'Asabeneh'
Expand Down
86 changes: 43 additions & 43 deletions 03_Day_Booleans_operators_date/03_booleans_operators_date.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@
![Thirty Days Of JavaScript](../images/banners/day_1_3.png)

- [📔 Day 3](#-day-3)
- [Booleans](#booleans)
- [Truthy values](#truthy-values)
- [Falsy values](#falsy-values)
- [Undefined](#undefined)
- [Null](#null)
- [Operators](#operators)
- [Assignment operators](#assignment-operators)
- [Arithmetic Operators](#arithmetic-operators)
- [Comparison Operators](#comparison-operators)
- [Logical Operators](#logical-operators)
- [Increment Operator](#increment-operator)
- [Decrement Operator](#decrement-operator)
- [Ternary Operators](#ternary-operators)
- [Operator Precendence](#operator-precendence)
- [Window Methods](#window-methods)
- [Window alert() method](#window-alert-method)
- [Window prompt() method](#window-prompt-method)
- [Window confirm() method](#window-confirm-method)
- [Date Object](#date-object)
- [Creating a time object](#creating-a-time-object)
- [Getting full year](#getting-full-year)
- [Getting month](#getting-month)
- [Getting date](#getting-date)
- [Getting day](#getting-day)
- [Getting hours](#getting-hours)
- [Getting minutes](#getting-minutes)
- [Getting seconds](#getting-seconds)
- [Getting time](#getting-time)
- [💻 Day 3: Exercises](#-day-3-exercises)
- [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2)
- [Exercises: Level 3](#exercises-level-3)
- [Booleans](#booleans)
- [Truthy values](#truthy-values)
- [Falsy values](#falsy-values)
- [Undefined](#undefined)
- [Null](#null)
- [Operators](#operators)
- [Assignment operators](#assignment-operators)
- [Arithmetic Operators](#arithmetic-operators)
- [Comparison Operators](#comparison-operators)
- [Logical Operators](#logical-operators)
- [Increment Operator](#increment-operator)
- [Decrement Operator](#decrement-operator)
- [Ternary Operators](#ternary-operators)
- [Operator Precedence](#operator-precedence)
- [Window Methods](#window-methods)
- [Window alert() method](#window-alert-method)
- [Window prompt() method](#window-prompt-method)
- [Window confirm() method](#window-confirm-method)
- [Date Object](#date-object)
- [Creating a time object](#creating-a-time-object)
- [Getting full year](#getting-full-year)
- [Getting month](#getting-month)
- [Getting date](#getting-date)
- [Getting day](#getting-day)
- [Getting hours](#getting-hours)
- [Getting minutes](#getting-minutes)
- [Getting seconds](#getting-seconds)
- [Getting time](#getting-time)
- [💻 Day 3: Exercises](#-day-3-exercises)
- [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2)
- [Exercises: Level 3](#exercises-level-3)

# 📔 Day 3

Expand All @@ -73,7 +73,7 @@ We agreed that boolean values are either true or false.
### Truthy values

- All numbers(positive and negative) are truthy except zero
- All strings are truthy
- All strings are truthy except an empty string ('')
- The boolean true

### Falsy values
Expand Down Expand Up @@ -218,7 +218,7 @@ console.log('python'.length > 'dragon'.length) // false
```

Try to understand the above comparisons with some logic. Remembering without any logic might be difficult.
JavaScript is some how a wired kind of programming language. JavaScript code run and give you a result but unless you are good at it may not be the desired result.
JavaScript is somehow a wired kind of programming language. JavaScript code run and give you a result but unless you are good at it may not be the desired result.

As rule of thumb, if a value is not true with == it will not be equal with ===. Using === is safer than using ==. The following [link](https://dorey.github.io/JavaScript-Equality-Table/) has an exhaustive list of comparison of data types.

Expand Down Expand Up @@ -254,7 +254,7 @@ let isMarried = !false // true

### Increment Operator

In JavaScrip we use the increment operator to increase a value stored in a variable. The increment could be pre or post increment. Let us see each of them:
In JavaScript we use the increment operator to increase a value stored in a variable. The increment could be pre or post increment. Let us see each of them:

1. Pre-increment

Expand All @@ -276,7 +276,7 @@ We use most of the time post-increment. At least you should remember how to use

### Decrement Operator

In JavaScrip we use the decrement operator to decrease a value stored in a variable. The decrement could be pre or post decrement. Let us see each of them:
In JavaScript we use the decrement operator to decrease a value stored in a variable. The decrement could be pre or post decrement. Let us see each of them:

1. Pre-decrement

Expand Down Expand Up @@ -333,9 +333,9 @@ number > 0
-5 is a negative number
```

### Operator Precendence
### Operator Precedence

I would like to recommend you to read about operator precendence from this [link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
I would like to recommend you to read about operator precedence from this [link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)

## Window Methods

Expand Down Expand Up @@ -382,7 +382,7 @@ These are not all the window methods we will have a separate section to go deep
## Date Object

Time is an important thing. We like to know the time a certain activity or event. In JavaScript current time and date is created using JavaScript Date Object. The object we create using Date object provides many methods to work with date and time.The methods we use to get date and time information from a date object values are started with a word _get_ because it provide the information.
_getFullYear(), getMonths(), getDate(), getDay(), getHours(), getMinutes, getSeconds(), getMilliseconds(), getTime(), getDay()_
_getFullYear(), getMonth(), getDate(), getDay(), getHours(), getMinutes, getSeconds(), getMilliseconds(), getTime(), getDay()_

![Date time Object](../images/date_time_object.png)

Expand Down Expand Up @@ -553,7 +553,7 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
```sh
Enter base: 20
Enter height: 10
The area of the triangle is 50
The area of the triangle is 100
```

1. Write a script that prompt the user to enter side a, side b, and side c of the triangle and and calculate the perimeter of triangle (perimeter = a + b + c)
Expand All @@ -568,9 +568,9 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
1. Get length and width using prompt and calculate an area of rectangle (area = length x width and the perimeter of rectangle (perimeter = 2 x (length + width))
1. Get radius using prompt and calculate the area of a circle (area = pi x r x r) and circumference of a circle(c = 2 x pi x r) where pi = 3.14.
1. Calculate the slope, x-intercept and y-intercept of y = 2x -2
1. Slope is (m = y2-y1/x2-x1). Find the slope between point (2, 2) and point(6,10)
1. Slope is m = (y<sub>2</sub>-y<sub>1</sub>)/(x<sub>2</sub>-x<sub>1</sub>). Find the slope between point (2, 2) and point(6,10)
1. Compare the slope of above two questions.
1. Calculate the value of y (y = x^2 + 6x + 9). Try to use different x values and figure out at what x value y is 0.
1. Calculate the value of y (y = x<sup>2</sup> + 6x + 9). Try to use different x values and figure out at what x value y is 0.
1. Writ a script that prompt a user to enter hours and rate per hour. Calculate pay of the person?

```sh
Expand Down Expand Up @@ -616,7 +616,7 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
1. Write a script that prompt the user to enter number of years. Calculate the number of seconds a person can live. Assume some one lives just hundred years

```sh
Enter number of yours you live: 100
Enter number of years you live: 100
You lived 3153600000 seconds.
```

Expand Down
2 changes: 1 addition & 1 deletion 03_Day_Booleans_operators_date/03_day_starter/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="en">

<head>
<title>30DaysOfJavaScript: 03 Day</title>
Expand Down
25 changes: 13 additions & 12 deletions 04_Day_Conditionals/04_day_conditionals.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
![Thirty Days Of JavaScript](../images/banners/day_1_4.png)

- [📔 Day 4](#-day-4)
- [Conditionals](#conditionals)
- [If](#if)
- [If Else](#if-else)
- [If Else if Else](#if-else-if-else)
- [Switch](#switch)
- [Ternary Operators](#ternary-operators)
- [💻 Exercises](#-exercises)
- [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2)
- [Exercises: Level 3](#exercises-level-3)
- [Conditionals](#conditionals)
- [If](#if)
- [If Else](#if-else)
- [If Else if Else](#if--else-if-else)
- [Switch](#switch)
- [Ternary Operators](#ternary-operators)
- [💻 Exercises](#-exercises)
- [Exercises: Level 1](#exercises-level-1)
- [Exercises: Level 2](#exercises-level-2)
- [Exercises: Level 3](#exercises-level-3)

# 📔 Day 4

Expand Down Expand Up @@ -189,7 +189,8 @@ switch(caseValue){
// code
break
case 3:
// code
// code
break
default:
// code
}
Expand Down Expand Up @@ -279,7 +280,7 @@ isRaining

### Exercises: Level 1

1. Get user input using prompt(“Enter your age:”). If user is 18 or older , give feedback:'You are old enough to drive' but if not 18 give another feedback stating to wait for the number of years he neds to turn 18.
1. Get user input using prompt(“Enter your age:”). If user is 18 or older , give feedback:'You are old enough to drive' but if not 18 give another feedback stating to wait for the number of years he needs to turn 18.

```sh
Enter your age: 30
Expand Down
8 changes: 4 additions & 4 deletions 04_Day_Conditionals/04_day_starter/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html>
<html lang="en">

<head>
<title>30DaysOfJavaScript</title>
<title>30DaysOfJavaScript</title>
</head>

<body>

<!-- import your scripts here -->
<script src="./scripts/main.js"></script>
<!-- import your scripts here -->
<script src="./scripts/main.js"></script>

</body>

Expand Down
Loading

0 comments on commit 838efcb

Please sign in to comment.