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

1
.gitignore vendored

@ -14,7 +14,6 @@ day9.md
day10.md day10.md
01_02_03_days_backup.md 01_02_03_days_backup.md
test.md test.md
28_Day
29_Day 29_Day
30_Day 30_Day
test.html 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 ```js
string.indexOf(substring) string.indexOf(substring)
@ -635,10 +635,11 @@ console.log(string.indexOf('Script')) //15
console.log(string.indexOf('script')) // -1 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 ```js
string.lastIndexOf(index) //syntax
string.lastIndexOf(substring)
``` ```
```js ```js
@ -801,7 +802,7 @@ console.log(typeof null) // object
### Changing data type(Casting) ### 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. When we do arithmetic operations string numbers should be first converted to integer or float if not it returns an error.
#### String to Int #### String to Int
@ -941,7 +942,7 @@ console.log(numInt) // 9
5 1 5 25 125 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 ### Exercises: Level 3

@ -125,7 +125,7 @@ Arithmetic operators are mathematical operators.
- Addition(+): a + b - Addition(+): a + b
- Subtraction(-): a - b - Subtraction(-): a - b
- Multiplication(_): a _ b - Multiplication(*): a * b
- Division(/): a / b - Division(/): a / b
- Modulus(%): a % b - Modulus(%): a % b
- Exponential(**): a ** b - Exponential(**): a ** b
@ -231,15 +231,15 @@ The following symbols are the common logical operators:
```js ```js
//&& ampersand operator example //&& ampersand operator example
const check = 4 > 3 && 10 > 5 // true and true -> true const check = 4 > 3 && 10 > 5 // true && true -> true
const check = 4 > 3 && 10 < 5 // true and false -> false const check = 4 > 3 && 10 < 5 // true && false -> false
const check = 4 < 3 && 10 < 5 // false and false -> false const check = 4 < 3 && 10 < 5 // false && false -> false
//|| pipe or operator, example //|| pipe or operator, example
const check = 4 > 3 || 10 > 5 // true and true -> true const check = 4 > 3 || 10 > 5 // true || true -> true
const check = 4 > 3 || 10 < 5 // true and false -> true const check = 4 > 3 || 10 < 5 // true || false -> true
const check = 4 < 3 || 10 < 5 // false and false -> false const check = 4 < 3 || 10 < 5 // false || false -> false
//! Negation examples //! 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] 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' 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 #### 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 ```js
// Declaring different variables of different data types // Declaring different variables of different data types
let firstName = 'Asabeneh' // first name of a person let firstName = 'Asabeneh' // first name of a person
let lastName = 'Yetayeh' // last name of a person let lastName = 'Yetayeh' // last name of a person
let country = 'Finland' // country let country = 'Finland' // country
let city = 'Helsinki' // capital city let city = 'Helsinki' // capital city
let isMarried = true // boolean data type let age = 100 // age in years
let isMarried = true
console.log(firstName, lastName, country, city, isMarried) console.log(firstName, lastName, country, city, age, isMarried)
``` ```
```sh ```sh

Loading…
Cancel
Save