pull/70/head
Asabeneh 6 years ago
parent 899a3c884e
commit 51f3b2071e

1
.gitignore vendored

@ -14,7 +14,6 @@ day9.md
day10.md
01_02_03_days_backup.md
test.md
28_Day
29_Day
30_Day
test.html

@ -617,7 +617,7 @@ console.log(string.charCodeAt(lastIndex)) // t ASCII is 116
```
13. *indexOf()*: Takes takes a substring and if the substring exists in a string it returns the first position of the substring if does not exist it returns -1
1. *indexOf()*: Takes a substring and if the substring exists in a string it returns the first position of the substring if does not exist it returns -1
```js
string.indexOf(substring)
@ -635,10 +635,11 @@ console.log(string.indexOf('Script')) //15
console.log(string.indexOf('script')) // -1
```
14. *lastIndexOf()*: Takes takes a substring and if the substring exists in a string it returns the last position of the substring if it does not exist it returns -1
1. *lastIndexOf()*: Takes a substring and if the substring exists in a string it returns the last position of the substring if it does not exist it returns -1
```js
string.lastIndexOf(index)
//syntax
string.lastIndexOf(substring)
```
```js
@ -801,7 +802,7 @@ console.log(typeof null) // object
### Changing data type(Casting)
- Casting: Converting one data type to another data type. We use _parseInt()_, _parsefloat()_,_Number()_, _+ sign_, _str()_
- Casting: Converting one data type to another data type. We use _parseInt()_, _parseFloat()_, _Number()_, _+ sign_, _str()_
When we do arithmetic operations string numbers should be first converted to integer or float if not it returns an error.
#### String to Int
@ -941,13 +942,13 @@ console.log(numInt) // 9
5 1 5 25 125
```
9. Use __substr__ to slice out the phase __because because because__ in the following sentence:__'You cannot end a sentence with because because because is a conjunction'__
9. Use __substr__ to slice out the phrase __because because because__ in the following sentence:__'You cannot end a sentence with because because because is a conjunction'__
### Exercises: Level 3
1. 'Love is the best thing in this world. Some found their love and some are still looking for their love.' Count the number of word love in this sentence.
2. Use __match()__ to count the number all because's in the following sentence:__'You cannot end a sentence with because because because is a conjunction'__
3. Clean the following text and find the most frequent word(hint, use replace and regular express).
3. Clean the following text and find the most frequent word (hint, use replace and regular express).
```js
const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching'

@ -125,10 +125,10 @@ Arithmetic operators are mathematical operators.
- Addition(+): a + b
- Subtraction(-): a - b
- Multiplication(_): a _ b
- Multiplication(*): a * b
- Division(/): a / b
- Modulus(%):a % b
- Exponential(**):a ** b
- Modulus(%): a % b
- Exponential(**): a ** b
```js
let numOne = 4
@ -231,15 +231,15 @@ The following symbols are the common logical operators:
```js
//&& ampersand operator example
const check = 4 > 3 && 10 > 5 // true and true -> true
const check = 4 > 3 && 10 < 5 // true and false -> false
const check = 4 < 3 && 10 < 5 // false and false -> false
const check = 4 > 3 && 10 > 5 // true && true -> true
const check = 4 > 3 && 10 < 5 // true && false -> false
const check = 4 < 3 && 10 < 5 // false && false -> false
//|| pipe or operator, example
const check = 4 > 3 || 10 > 5 // true and true -> true
const check = 4 > 3 || 10 < 5 // true and false -> true
const check = 4 < 3 || 10 < 5 // false and false -> false
const check = 4 > 3 || 10 > 5 // true || true -> true
const check = 4 > 3 || 10 < 5 // true || false -> true
const check = 4 < 3 || 10 < 5 // false || false -> false
//! Negation examples

@ -331,7 +331,7 @@ const eight0values = Array(8).fill(0) // it creates eight element values filled
console.log(eight0values) // [0, 0, 0, 0, 0, 0, 0, 0]
const four4values = Array(4).fill(4) // it creates 4 element values filled with '4'
console.log(four4values) // [4, 4, 4, 4, 4, 4, 4, 4]
console.log(four4values) // [4, 4, 4, 4]
```
#### Concatenating array using concat

@ -0,0 +1,37 @@
<div align="center">
<h1> 30 Days Of JavaScript</h1>
<a class="header-badge" target="_blank" href="https://www.linkedin.com/in/asabeneh/">
<img src="https://img.shields.io/badge/style--5eba00.svg?label=LinkedIn&logo=linkedin&style=social">
</a>
<a class="header-badge" target="_blank" href="https://twitter.com/Asabeneh">
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/asabeneh?style=social">
</a>
<sub>Author:
<a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
<small> January, 2020</small>
</sub>
</div>
[<< Day 27](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master27_Day27_day_dom_day_7.md) | [Day 29>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/29_Day/29_day_dom_day_9.md)
![Thirty Days Of JavaScript](../images/banners/day_1_28.png)
- [Day 28](#day-28)
- [Exercises](#exercises)
- [Exercise: Level 1](#exercise-level-1)
# Day 28
## Exercises
### Exercise: Level 1
1. Create the following using HTML, CSS, and JavaScript
![Slider](./../images/projects/dom_mini_project_leaderboard_day_8.1.png)
🎉 CONGRATULATIONS ! 🎉
[<< Day 27](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master27_Day27_day_dom_day_7.md) | [Day 29>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/29_Day/29_day_dom_day_9.md)

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>30DaysOfJavaScript:11 Day </title>
</head>
<body>
<h1>30DaysOfJavaScript:11 Day</h1>
<h2>Destructuring and Spread</h2>
<script src="./data/countries_data.js"></script>
<script src="./scripts/main.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

@ -536,14 +536,14 @@ Let us declare variables with different data types. To declare a variable, we ne
```js
// Declaring different variables of different data types
let firstName = 'Asabeneh' // first name of a person
let lastName = 'Yetayeh' // last name of a person
let country = 'Finland' // country
let city = 'Helsinki' // capital city
let isMarried = true // boolean data type
console.log(firstName, lastName, country, city, isMarried)
let firstName = 'Asabeneh' // first name of a person
let lastName = 'Yetayeh' // last name of a person
let country = 'Finland' // country
let city = 'Helsinki' // capital city
let age = 100 // age in years
let isMarried = true
console.log(firstName, lastName, country, city, age, isMarried)
```
```sh

Loading…
Cancel
Save