Skip to content

Commit b257090

Browse files
committed
day 2 fixes
1 parent c1095b9 commit b257090

1 file changed

Lines changed: 30 additions & 34 deletions

File tree

readMe.md

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,9 @@
4343
- [Concatenating using addition operator](#concatenating-using-addition-operator)
4444
- [Template Literals(Template Strings)](#template-literalstemplate-strings)
4545
- [String Methods](#string-methods)
46-
- [Booleans](#booleans-1)
47-
- [Undefined](#undefined-1)
48-
- [Null](#null-1)
49-
- [Operators](#operators)
50-
- [Assignment operators](#assignment-operators)
51-
- [Arithmetic Operators](#arithmetic-operators)
52-
- [Comparison Operators](#comparison-operators)
53-
- [Logical Operators](#logical-operators)
54-
- [💻 Day 2: Exercises](#%f0%9f%92%bb-day-2-exercises)
55-
- [String Part](#string-part)
56-
- [Data types Part](#data-types-part)
57-
- [Arithmetic Operators Part](#arithmetic-operators-part)
58-
- [Booleans Part](#booleans-part)
59-
- [Comparison Operators](#comparison-operators-1)
60-
- [Logical Operators](#logical-operators-1)
46+
- [Exercises: Booleans Part](#exercises-booleans-part)
47+
- [Exercises: Comparison Operators](#exercises-comparison-operators)
48+
- [Exercises: Logical Operators](#exercises-logical-operators)
6149

6250

6351

@@ -828,7 +816,7 @@ console.log(country.substring(3, 7)) // land
828816
console.log(country.substring(3)) // land
829817

830818
```
831-
7. *split(): The split method splits a string at a specified place.
819+
7. *split()*: The split method splits a string at a specified place.
832820

833821
```js
834822
let string = '30 Days Of JavaScipt'
@@ -926,7 +914,7 @@ console.log(string.indexOf('script')) // -1
926914
```
927915
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
928916
```js
929-
string.charCodeAt(index)
917+
string.lastIndexOf(index)
930918
```
931919
```js
932920
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
@@ -936,9 +924,9 @@ console.log(string.lastIndexOf('JavaScript')) // 38
936924
937925
```
938926
939-
15. *concat()*: it takes many substrings and creates concatenation.
927+
15. *concat()*: it takes many substrings and creates concatenation.
940928
```js
941-
string.concate(substring, substring, substring)
929+
string.concat(substring, substring, substring)
942930
```
943931
```js
944932
let string = '30'
@@ -948,7 +936,7 @@ console.log(country.concat("land")) // Finland
948936
949937
```
950938
951-
16. *startsWith*: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
939+
16. *startsWith*: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
952940
```js
953941
string.startsWith(substring)
954942
```
@@ -964,7 +952,7 @@ console.log(country.startsWith('fin')) // false
964952
console.log(country.startsWith('land')) // false
965953
966954
```
967-
17. *endsWith*: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
955+
17. *endsWith*: it takes a substring as an argument and it checks if the string starts with that specified substring. It returns a boolean(true or false).
968956
```js
969957
string.endsWith(substring)
970958
```
@@ -980,16 +968,16 @@ console.log(country.endsWith('fin')) // false
980968
console.log(country.endsWith('Fin')) // false
981969
982970
```
983-
18. *search*: it takes a substring as an argument and it returns the index of the first match.
971+
18. *search*: it takes a substring as an argument and it returns the index of the first match.
984972
```js
985-
string.serch(substring)
973+
string.search(substring)
986974
```
987975
```js
988976
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
989977
console.log(string.search('love')) // 2
990978
991979
```
992-
19. *match*: it takes a substring or regular expression pattern as an argument and it returns an array if there is match if not it returns null. Let us see how a regular expression pattern looks like. It starts with / sign and ends with / sign.
980+
19. *match*: it takes a substring or regular expression pattern as an argument and it returns an array if there is match if not it returns null. Let us see how a regular expression pattern looks like. It starts with / sign and ends with / sign.
993981
```js
994982
let string = 'love'
995983
let patternOne = /love/ // with out any flag
@@ -1021,6 +1009,13 @@ let regEx = /\d+/ // d with escape character means d not a normal d instead acts
10211009
console.log(text.match(regEx)) // ["2", "0", "1", "9", "3", "0", "2", "0", "2", "0"]
10221010
console.log(text.match(/\d+/g)) // ["2019", "30", "2020"]
10231011
```
1012+
1. *repeat()*: it takes a number argument and it returned the repeated version of the string.
1013+
```js
1014+
string.repeat(n)
1015+
```
1016+
```js
1017+
let string = 'love'
1018+
console.log(string.repeat(10)) // lovelovelovelovelovelovelovelovelovelove
10241019
10251020
# Booleans
10261021
@@ -1121,7 +1116,9 @@ console.log(3 != 2) // true, because 3 is not equal to 2
11211116
console.log(3 == '3') // true, compare only value
11221117
console.log(3 === '3') // false, compare both value and data type
11231118
console.log(3 !== '3') // true, compare both value and data type
1124-
console.log(3 != '3') // false, compare only value
1119+
console.log(3 !== '3') // true, compare both value and data type
1120+
console.log(3 != 3) // false, compare only value
1121+
console.log(3 !== 3) // false, compare both value and data type
11251122
11261123
console.log('mango'.length == 'avocado'.length) // false
11271124
console.log('mango'.length != 'avocado'.length) // true
@@ -1160,7 +1157,7 @@ let isMarried = !false; // -> true
11601157
11611158
# 💻 Day 2: Exercises
11621159
1163-
## String Part
1160+
## Exercises: String Part
11641161
11651162
1. Declare a variable name challenge and assign it to an initial value **'30 Days Of JavaScript'**.
11661163
2. Print the string on the browser console using __console.log()__
@@ -1193,14 +1190,13 @@ let isMarried = !false; // -> true
11931190
29. Calculate the total annual income of the person by extract the numbers from the following text. 'He earns 5000 euro from salary per month, 10000 euro annual bonus, 15000 euro online courses per month.'
11941191
30. Clean the following text and find the most frequent word(hint, use replace and regular express).
11951192
```js
1196-
sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %tea@ching%;. There $is nothing; &as& mo@re rewarding as educa@ting &and& @emp%o@wering peo@ple. ;I found tea@ching m%o@re interesting tha@n any other %jo@bs. %Do@es thi%s mo@tivate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is also $the $result of &love& of tea&ching'
1193+
const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %tea@ching%;. There $is nothing; &as& mo@re rewarding as educa@ting &and& @emp%o@wering peo@ple. ;I found tea@ching m%o@re interesting tha@n any other %jo@bs. %Do@es thi%s mo@tivate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is also $the $result of &love& of tea&ching'
11971194
```
1198-
## Data types Part
1199-
1200-
String, number, boolean, null, undefined and symbol(ES6) are JavaScript primitive data types.
1195+
## Exercises: Data types Part
1196+
1. Declare firstName, lastName, country, city, age, isMarried, year variable and assign value to it
12011197

12021198
1. The JavaScript typeof operator uses to check different data types. Check the data type of each variables from question number 1.
1203-
2.
1199+
12041200
## Arithmetic Operators Part
12051201
JavaScript arithmetic operators are addition(+), subtraction(-), multiplication(\*), division(/), modulus(%), increment(++) and decrement(--).
12061202

@@ -1210,7 +1206,7 @@ let operandTwo = 3;
12101206
```
12111207
Using the above operands apply different JavaScript arithmetic operations.
12121208

1213-
## Booleans Part
1209+
## Exercises: Booleans Part
12141210

12151211
Boolean value is either true or false.
12161212

@@ -1230,7 +1226,7 @@ Boolean value is either true or false.
12301226
1. 4 == '4'
12311227
1. 4 === '4'
12321228

1233-
## Comparison Operators
1229+
## Exercises: Comparison Operators
12341230

12351231
Boolean value is either true or false. Any comparison return a boolean either true or false.
12361232
Use all the following comparison operators to compare the following values: >, < >=, <=, !=, !==,===.
@@ -1248,7 +1244,7 @@ Which are true or which are false ?
12481244
1. 4 == '4'
12491245
1. 4 === '4'
12501246

1251-
## Logical Operators
1247+
## Exercises: Logical Operators
12521248

12531249
Which are true or which are false ?
12541250

0 commit comments

Comments
 (0)