// 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).
// string.endsWith(substring)
letstring='Love is the best to in this world'
console.log(string.endsWith('world'))// true
console.log(string.endsWith('love'))// false
console.log(string.endsWith('in this world'))// true
// includes(): It takes a substring argument and it check if substring argument exists in the string. includes() returns a boolean. It checks if a substring exist in a string and it returns true if it exists and false if it doesn't exist.
// 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
// 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
letstring='I love JavaScript. If you do not love JavaScript what else can you love.'
// 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.
letstring='love'
letpatternOne=/love/// with out any flag
letpatternTwo=/love/gi// g-means to search in the whole text, i - case insensitive
string.match(substring)
letstring='I love JavaScript. If you do not love JavaScript what else can you love.'
console.log(string.match('love'))//
/*
output
["love",index:2,input:"I love JavaScript. If you do not love JavaScript what else can you love.",groups:undefined]
// 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).
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
```js
string.charCodeAt(index)
string.lastIndexOf(index)
```
```js
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
18. *search*: it takes a substring as an argument and it returns the index of the first match.
```js
string.serch(substring)
string.search(substring)
```
```js
let string = 'I love JavaScript. If you do not love JavaScript what else can you love.'
console.log(string.search('love')) // 2
```
1.*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 expresson pattern looks like. It starts with / sign and ends with / sign.
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.
```js
let string = 'love'
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
27. Use __repeat()__ method to print 30 Days Of JavaScript 2 times
28. 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.
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.'
30. Clean the following text(hint, use replace and regular express)
30. Clean the following text and find the most frequent word(hint, use replace and regular express).
```js
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!?'
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'
```
## Data types Part
String, number, boolean, null, undefined and symbol(ES6) are JavaScript primitive data types.
## Exercises: Data types Part
1. Declare firstName, lastName, country, city, age, isMarried, year variable and assign value to it
1. The JavaScript typeof operator uses to check different data types. Check the data type of each variables from question number 1.
2.
## Arithmetic Operators Part
JavaScript arithmetic operators are addition(+), subtraction(-), multiplication(\*), division(/), modulus(%), increment(++) and decrement(--).
JavaScript arithmetic operators are addition(+), subtraction(-), multiplication(*), division(/), modulus(%), exponential(**), increment(++) and decrement(--).
```js
let operandOne = 4;
@ -1215,31 +1206,16 @@ let operandTwo = 3;
```
Using the above operands apply different JavaScript arithmetic operations.
## Booleans Part
## Exercises: Booleans Part
Boolean value is either true or false.
1. Write three JavaScript statement which provide truthy value.
1. Write three JavaScript statement which provide falsy value.
1. Use all the following comparison operators to compare the following values: >, < >=, <=, !=, !==,===.
Which are true or which are false ?
1. 4 > 3
1. 4 >= 3
1. 4 <3
1. 4 <= 3
1. 4 == 4
1. 4 === 4
1. 4 != 4
1. 4 !== 4
1. 4 != '4'
1. 4 == '4'
1. 4 === '4'
## Comparison Operators
## Exercises: Comparison Operators
Boolean value is either true or false. Any comparison return a boolean either true or false.
Use all the following comparison operators to compare the following values: >, < >=, <=, !=, !==,===.
Which are true or which are false ?
Figure out the result of the following comparison expression first without using console.log(). After you decide the result confirm it using console.log()
1. 4 > 3
1. 4 >= 3
@ -1253,10 +1229,8 @@ Which are true or which are false ?
1. 4 == '4'
1. 4 === '4'
## Logical Operators
Which are true or which are false ?
## Exercises: Logical Operators
Figure out the result of the following expressions first without using console.log(). After you decide the result confirm it by using console.log()