diff --git a/02_Day_Data_types/02_day_data_types.md b/02_Day_Data_types/02_day_data_types.md
index e27d43d..70e56d4 100644
--- a/02_Day_Data_types/02_day_data_types.md
+++ b/02_Day_Data_types/02_day_data_types.md
@@ -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. Arrays
+2. Functions
+3. 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.
diff --git a/02_Day_Data_types/02_day_starter/index.html b/02_Day_Data_types/02_day_starter/index.html
index 8fbbe0d..2850e00 100644
--- a/02_Day_Data_types/02_day_starter/index.html
+++ b/02_Day_Data_types/02_day_starter/index.html
@@ -3,14 +3,19 @@
30DaysOfJavaScript
+
+
30DaysOfJavaScript:02 Day
Data types
+
-
-
+
+
diff --git a/02_Day_Data_types/02_day_starter/main.js b/02_Day_Data_types/02_day_starter/main.js
deleted file mode 100644
index 7762908..0000000
--- a/02_Day_Data_types/02_day_starter/main.js
+++ /dev/null
@@ -1 +0,0 @@
-// this is your main.js script
\ No newline at end of file
diff --git a/02_Day_Data_types/02_day_starter/soluciones.js b/02_Day_Data_types/02_day_starter/soluciones.js
new file mode 100644
index 0000000..69749ef
--- /dev/null
+++ b/02_Day_Data_types/02_day_starter/soluciones.js
@@ -0,0 +1,175 @@
+// this is your main.js script//
+
+//1. Declare a variable named challenge and assign it to an initial value '30 Days Of JavaScript'.
+ let challenge = '30 Days Of JavaScript'
+//2. Print the string on the browser console using console.log()
+console.log(challenge);
+
+//3. Print the length of the string on the browser console using console.log()
+console.log(challenge.length)
+
+//4. Change all the string characters to capital letters using toUpperCase() method
+let Uppercase = challenge.toLocaleUpperCase()
+
+//5.Change all the string characters to lowercase letters using toLowerCase() method
+let lowercase = challenge.toLowerCase()
+
+//6. Cut (slice) out the first word of the string using substr() or substring() method
+let cut = challenge.substring(0,2)
+
+//7.Slice out the phrase Days Of JavaScript from 30 Days Of JavaScript.
+let cut2 = challenge.substring(2,21)
+
+//8.Check if the string contains a word Script using includes() method
+let includes = challenge.includes('Script ')
+
+//9.Split the string into an array using split() method
+console.log(challenge.split()) // Changes to an array -> ["30 Days Of JavaScript"]
+
+//10.Split the string 30 Days Of JavaScript at the space using split() method
+console.log(challenge.split(' ')) // Split to an array at space -> ["30", "Days", "Of", "JavaScript"]
+
+//11. 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon' split the string at the comma and change it to an array.
+let companies = 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon'
+console.log(countries.split(',')) //["Facebook", "Google", " Microsoft", " Apple", " Oracle", "Amazon"]
+
+
+//12.Change 30 Days Of JavaScript to 30 Days Of Python using replace() method.
+console.log(challenge.replace('JavaScript', 'Python'))
+
+
+//13.What is character at index 15 in '30 Days Of JavaScript' string? Use charAt() method.
+console.log(challenge.charAt(15)) //S
+
+
+//14.What is the character code of J in '30 Days Of JavaScript' string using charCodeAt()
+console.log(challenge.charCodeAt('J'))// 51
+
+//15. Use indexOf to determine the position of the first occurrence of a in 30 Days Of JavaScript
+console.log(challenge.indexOf('a'))
+
+//16.Use lastIndexOf to determine the position of the last occurrence of a in 30 Days Of JavaScript.
+console.log(challenge.lastIndexOf('a'))
+
+//17. Use indexOf to find the position of the first occurrence of the word because in the following sentence:'You cannot end a sentence with because because because is a conjunction'
+let sentenceWord = 'You cannot end a sentence with because because because is a conjunction'
+
+console.log(sentenceWord.indexOf('because'))
+
+//18. Use lastIndexOf to find the position of the last occurrence of the word because in the following sentence:'You cannot end a sentence with because because because is a conjunction'
+console.log(sentenceWord.lastIndexOf('because'))
+
+// 19. Use search to find the position of the first occurrence of the word because in the following sentence:'You cannot end a sentence with because because because is a conjunction'
+console.log(sentenceWord.search('because'))
+
+// 20. Use trim() to remove any trailing whitespace at the beginning and the end of a string.E.g ' 30 Days Of JavaScript
+console.log(challenge.trim(' '))
+
+// 21. Use startsWith() method with the string 30 Days Of JavaScript and make the result true
+console.log(challenge.startsWith('30'))
+
+// 22. Use endsWith() method with the string 30 Days Of JavaScript and make the result true
+console.log(challenge.endsWith('30'))
+
+//23. Use match() method to find all the a’s in 30 Days Of JavaScript
+console.log(challenge.match(/a/g))
+
+// 24. Use concat() and merge '30 Days of' and 'JavaScript' to a single string, '30 Days Of JavaScript'
+let a = '30 Days of '
+let b = 'JavaScript'
+console.log(a.concat(b))
+//25. Use repeat() method to print 30 Days Of JavaScript 2 times
+console.log(challenge.repeat(2))
+
+// Exercise: Level 2
+
+//1.Using console.log() print out the following statement: The quote 'There is no exercise better for the heart than reaching down and lifting people up.' by John Holmes teaches us to help one another.
+console.log('There is no exercise better for the heart than reaching down and lifting people up.')
+
+//2. Using console.log() print out the following quote by Mother Teresa:"Love is not patronizing and charity isn't about pity, it is about love. Charity and love are the same -- with charity you give love, so don't just give money but reach out your hand instead."
+console.log('Love is not patronizing and charity isn\'t about pity, it is about love. Charity and love are the same -- with charity you give love, so don\'t just give money but reach out your hand instead.')
+
+//3. Check if typeof '10' is exactly equal to 10. If not make it exactly equal.
+console.log ('10'===10)
+console.log( 10===10)
+
+//4. Check if parseFloat('9.8') is equal to 10 if not make it exactly equal with 10.
+let stringNum = '9.8'
+let numRound = Math.round(parseFloat(stringNum))
+
+
+//5. Check if 'on' is found in both python and jargon
+let phrase = 'python, jargon'
+let foundWord = /on/g
+console.log(phrase.match(foundWord))
+
+//6. I hope this course is not full of jargon. Check if jargon is in the sentence.
+let jargonSentence = 'I hope this course is not full of jargon'
+console.log(jargonSentence.match('jargon'))
+
+//7.Generate a random number between 0 and 100 inclusively.
+
+/*let randomNum = Math.random()
+let randomZerotoCent = randomNum * 101
+console.log(Math.round(randomZerotoCent))*/
+function randomNum(){
+let random = Math.floor(Math.random() * 101);
+return random;
+}
+//8. Generate a random number between 50 and 100 inclusively.
+console.log(Math.floor( Math.random() * (100 - 50) + 50))
+
+//9. Generate a random number between 0 and 255 inclusively.
+console.log(Math.floor(Math.random() * 256))
+
+//10. Access the 'JavaScript' string characters using a random number.
+let string = 'JavaScript'
+console.log(string[Math.floor(Math.random()*string.length)])
+
+//11. Use console.log() and escape characters to print the following pattern.
+/* 1 1 1 1 1
+ 2 1 2 4 8
+ 3 1 3 9 27
+ 4 1 4 16 64
+ 5 1 5 25 125 */
+ console.log('1 1 1 1 1\n2 1 2 4 8\n3 1 3 9 27\n4 1 4 16 64\n5 15 25 125 125')
+
+//12. Use substr to slice out the phrase because because because from the following sentence:'You cannot end a sentence with because because because is a conjunction'
+let sentenceBecause = 'You cannot end a sentence with because because because is a conjunction'
+console.log(sentenceBecause.substring(31,54))// because because because
+
+//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.
+var str = "'Love is the best thing in this world. Some found their love and some are still looking for their love.'";
+var wordCount = str.match(/love/gim).length;
+console.log(wordCount);//3
+
+//2. Use match() to count the number of all because in the following sentence:'You cannot end a sentence with because because because is a conjunction'
+let sentenceBecause1 = 'You cannot end a sentence with because because because is a conjunction'
+ console.log(sentenceBecause1.match(/because/gm).length)
+
+
+// 3. Clean the following text and find the most frequent word (hint, use replace and regular expressions). 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'
+
+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'
+
+let cleanSentence = sentence.replace([/%!@&?$&;/g],'');
+
+//4. Calculate the total annual income of the person by extracting the numbers from the following text. 'He earns 5000 euro from salary per month, 10000 euro annual bonus, 15000 euro online courses per month.'
+let text = 'He earns 5000 euro from salary per month, 10000 euro annual bonus, 15000 euro online courses per month.'
+
+let textSplit = text.split(' ')
+let salary = parseInt(textSplit[2])
+let bonus = parseInt(textSplit[8])
+let courses = parseInt(textSplit[12])
+let annualIncome = salary + bonus + courses
+console.log(annualIncome) //30000
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/03_Day_Booleans_operators_date/03_day_starter/scripts/main.js b/03_Day_Booleans_operators_date/03_day_starter/scripts/main.js
index 7762908..cc262b7 100644
--- a/03_Day_Booleans_operators_date/03_day_starter/scripts/main.js
+++ b/03_Day_Booleans_operators_date/03_day_starter/scripts/main.js
@@ -1 +1,226 @@
-// this is your main.js script
\ No newline at end of file
+// this is your main.js script
+
+//1.Declare firstName, lastName, country, city, age, isMarried, year variable and assign value to it and use the typeof operator to check different data types.
+
+let firtsName = 'Jose'
+typeof firtsName
+'string'
+let age = 32
+'number'
+typeof age
+'boolean'
+
+//2.Check if type of '10' is equal to 10
+ const type = '10'=== 10
+//3.Check if parseInt('9.8') is equal to 10
+ const parse = parseInt('9.8')
+ parse===10
+//4.Boolean value is either true or false.
+
+ //i.Write three JavaScript statement which provide truthy value.
+ let white = true
+ white ? console.log('is white'): console.log('is not white')
+
+ let monday = true
+ monday? console.log('week start'): console.log('weekend')
+
+ let road = true
+ road ? console.log('road is open'): console.log('road is close')
+
+ //ii.Write three JavaScript statement which provide falsy value.
+
+ let door= false
+ door ? console.log(`door is close`):console.log(`door is open`)
+
+ let noche = false
+ noche ? console.log('es de dia'): console.log('es noche')
+
+//5.Figure out the result of the following comparison expression first without using console.log(). After you decide the result confirm it using console.log()
+
+
+//i. 4 > 3 true
+//ii. 4 >= 3 true
+//iii 4 < 3 true
+//v. 4 <= 3 false
+//iv. 4 == 4 true
+//vi. 4 === 4 true
+//vii. 4 != 4 false
+//viii. 4 !== 4 false
+//ix. 4 != '4' true
+//x. 4 == '4' true
+//xi. 4 === '4' false
+
+//xii. Find the length of python and jargon and make a falsy comparison statement.
+console.log('wordJargon'.length!=='wordPython'.length)
+
+
+//6.Figure out the result of the following expressions first without using console.log(). After you decide the result confirm it by using console.log()
+
+//i. 4 > 3 && 10 < 12
+//ii. 4 > 3 && 10 > 12
+//iii 4 > 3 || 10 < 12
+//v. 4 > 3 || 10 > 12
+//iv. !(4 > 3)
+//vi. !(4 < 3)
+//vii. !(false)
+//viii. !(4 > 3 && 10 < 12)
+//ix. !(4 > 3 && 10 > 12)
+//x. !(4 === '4')
+//xi. There is no 'on' in both dragon and python
+
+//7.Use the Date object to do the following activities
+
+//i.What is the year today?
+const now = new Date()
+const year = now.getFullYear()
+
+//ii.What is the month today as a number?
+const month = now.getMonth()+1
+
+//iii.What is the date today?
+const date = now.getDate()
+
+//iv. What is the day today as a number?
+const day = now.getDay()
+
+//v. What is the hours now?
+const hours = now.getHours()
+
+//vi. What is the minutes now?
+console.log(now.getMinutes())
+
+//vii. Find out the numbers of seconds elapsed from January 1, 1970 to now.
+const allseconds = Date.now()
+
+
+//Exercises: Level 2
+
+//1. Write a script that prompt the user to enter base and height of the triangle and calculate an area of a triangle (area = 0.5 x b x h).
+let base = parseInt(prompt('base', 'enter base'))
+let height = parseInt(prompt('Height','Enter height'))
+let areaTriangle = base * height * 0.5
+console.log(areaTriangle)
+
+//2. 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)
+let sideA = parseInt(prompt('Side a', 'Enter side a'))
+let sideB = parseInt(prompt('Side b', 'Enter side b'))
+let sideC = parseInt(prompt('Side c', 'Enter side c'))
+let perimeter = sideA + sideB + sideC
+console.log(perimeter)
+
+//3.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))
+let length = parseInt(prompt('length', 'Enter length'))
+let width = parseInt(prompt('Height','Enter width'))
+let areaRectangle = length * width
+console.log(areaTriangle)
+let perimeterRectangle = 2 * (length + width)
+console.log(perimeterRectangle)
+
+//4. 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.
+const PI = 3.14
+let radius = parseInt(prompt('Radius', 'Enter radius'))
+let area = PI * (radius**2)
+console.log(area)
+let circunference = 2 * PI * radius
+console.log(circunference)
+
+//5.Calculate the slope, x-intercept and y-intercept of y = 2x -2
+let y1 = 2;
+let y2 = -2;
+let x1 = 2;
+let x2 = -2;
+console.log(`Slope is${(y2 - y1) / (x1 - x2)}`); //-1
+
+
+//6.Slope is m = (y2-y1)/(x2-x1). Find the slope between point (2, 2) and point(6,10)
+let slope = console.log(`Slope is${(2, 2) / (6, 10)}`); // 0.2
+
+//7.Compare the slope of above two questions.
+
+
+//8.Calculate the value of y (y = x2 + 6x + 9). Try to use different x values and figure out at what x value y is 0.
+let xs1 = 2
+let xs2 = 6
+let y = xs1 + xs2 + 9
+console.log(y)
+
+//9.Write a script that prompt a user to enter hours and rate per hour. Calculate pay of the person?
+
+/*Enter hours: 40
+Enter rate per hour: 28
+Your weekly earning is 1120*/
+let payHours = parseInt(prompt('Hours', 'Enter hours worked'))
+let ratePerHour = parseInt(prompt('Rate per hour', 'Enter rate per hour $'))
+let earnings = payHours * ratePerHour
+console.log(earnings)
+
+
+//10.If the length of your name is greater than 7 say, your name is long else say your name is short.
+let names = 'Jose'
+names.length > 7 ? console.log('your name is long'): console.log('name is short')
+
+function namesLength(name){
+ name= prompt('enter name'), name.length > 7 ? console.log('your name is long'): console.log('name is short');}
+
+//11.Compare your first name length and your family name length and you should get this output.
+let firstName = 'Jose'
+let lastName = 'linardo'
+let compareNames = firstName.length > lastName.length ? console.log('Your first name ' + firstName + 'is longer than your family name ' + lastName): console.log('your first name ' + firstName + 'is smaller than your family name ' + lastName)
+
+//12. Declare two variables myAge and yourAge and assign them initial values and myAge and yourAge.
+let myAge = parseInt(prompt('my age'))
+let yourAge = parseInt(prompt('your age'))
+let compareAges = myAge > yourAge ? console.log(`I am ${(myAge-yourAge)}years older than you.`): console.log(`I am ${(yourAge-myAge)} years young than you`)
+
+//13.Using prompt get the year the user was born and if the user is 18 or above allow the user to drive if not tell the user to wait a certain amount of years.
+
+/*Enter birth year: 1995
+You are 25. You are old enough to drive
+
+Enter birth year: 2005
+You are 15. You will be allowed to drive after 3 years.*/
+let birthYear = prompt('Enter your Birth year')
+let minAge = 18
+if(birthYear.length===4){
+let age_ = now.getFullYear()-parseInt(birthYear)
+const ageToDrive = age_< 18? console.log(`You are. ${age_} You will be allowed to drive after ${(minAge-age_)} years`): console.log(`You are ${age_} You are old enough to drive`)}
+else{ alert('Please enter your complete birth year.It should not be less than 4 numbers' )
+}
+
+//14.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
+
+/*Enter number of years you live: 100
+You lived 3153600000 seconds.*/
+let numberOfSeconds = parseInt(prompt('Enter years'))*(60*60 *24*365)
+console.log(numberOfSeconds)
+
+//15.Create a human readable time format using the Date time object
+
+// i. YYYY-MM-DD HH:mm
+const now_= new Date()
+let day_ = `${(now_.getDate())}`.padStart(2,'0');
+ let month_ = `${(now_.getMonth()+1)}`.padStart(2,'0');
+ let year_ = now_.getFullYear();
+ const date_ = now_.getDate();
+ let minutes = now_.getMinutes()
+ const hours_ = now_.getHours()
+console.log(`${year_}/${month_}/${day_}/${hours_}:${minutes}`);
+
+//ii. YYYY-MM-DD HH:mm
+console.log(`${year_}/${month_}/${day_}/${hours_}:${minutes}`);
+
+//iii. DD/MM/YYYY HH:mm*/
+console.log(`${day_}/${month_}/${year_}/${hours_}:${minutes}`);
+
+ //Exercises: Level 3
+
+ /*1.Create a human readable time format using the Date time object. The hour and the minute should be all the time two digits(7 hours should be 07 and 5 minutes should be 05 )
+ padStart(2,'0')
+ i.YYY-MM-DD HH:mm eg. 20120-01-02 07:05
+
+var numero = parseInt(prompt("introduzca un número"));
+ while (numero >= 10) {
+ numero = numero.toString().split('').map(x => parseInt(x) )
+ .reduce( (x, y) => x + y);
+ }
+ alert(numero);*/
\ No newline at end of file
diff --git a/04_Day_Conditionals/04_day_starter/scripts/main.js b/04_Day_Conditionals/04_day_starter/scripts/main.js
index ad0c1eb..718bd4e 100644
--- a/04_Day_Conditionals/04_day_starter/scripts/main.js
+++ b/04_Day_Conditionals/04_day_starter/scripts/main.js
@@ -1,3 +1,109 @@
// this is your main.js script
-alert('Open the browser console whenever you work on JavaScript')
\ No newline at end of file
+alert('Open the browser console whenever you work on JavaScript')
+//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 needs to turn 18.
+let yourAge = prompt('Enter you age')
+if(yourAge >= 18){
+console.log('you are old enough to drive')
+}else {
+console.log(`You are left whih ${(18 - yourAge )} to drive`)
+}
+
+//2.Compare the values of myAge and yourAge using if … else. Based on the comparison and log the result to console stating who is older (me or you). Use prompt(“Enter your age:”) to get the age as input.
+let myAge = prompt('Enter my age')
+let yourAge_ = prompt('Enter your age')
+if(myAgeyourAge_){
+ console.log(`I am ${myAge - yourAge_} years older than you`)
+ }else{
+ console.log('we are same age')
+ }
+
+ //3.If a is greater than b return 'a is greater than b' else 'a is less than b'. Try to implement it in to ways
+ let a = 4
+ let b = 3
+
+ if(a>b){
+console.log(`${a} is greater than ${b}`)
+ }else if(a b ? console.log('a is greater than b'):a=80){
+console.log(`your score es A`)
+}else if(scores>=70 && scores<=89){
+ console.log('your score is B')
+}else if(scores >=60 && scores<=69){
+ console.log('your score is C')
+}else if(scores >=50 && scores<=59){
+ console.log('your score is D')
+}else if(scores >=0 && scores<=49){
+ console.log('Your score es F')
+}else{
+ console.log('Max score is 100')
+}
+
+/*2.Check if the season is Autumn, Winter, Spring or Summer. If the user input is :
+° September, October or November, the season is Autumn.
+° December, January or February, the season is Winter.
+° March, April or May, the season is Spring
+° June, July or August, the season is Summer*/
+let season = prompt('Enter month')
+season = season.toLowerCase()
+if(season==='september' || season === 'october'|| season==='november'){
+ console.log('Season is Autumn')
+}else if(season==='december'|| season==='january'|| season==='february'){
+ console.log('the season is Spring')
+}else{
+ console.log('the season is Summer')
+}
+
+//3.Check if a day is weekend day or a working day. Your script will take day as an input.
+let daysOfWeek = ['monday', 'tuesday', 'wedsnesday','thursday', 'friday', 'saturday', 'sunday'];
+
+let input = prompt('Enter day').toLowerCase();
+ input === daysOfWeek[5] || input === daysOfWeek[6]? console.log(`${input[0].toUpperCase() + input.slice(1)} is a weekend`):
+input === daysOfWeek[0] || input === daysOfWeek[1] || input === daysOfWeek[2] || input === input[3] || input === daysOfWeek[4]? console.log(`${input[0].toUpperCase() + input.slice(1)} is a day working`):console.log(`${input} no es un dia de la semana`);
+
+//Exercises: Level 3
+
+//1. Write a program which tells the number of days in a month.
+
+const months = {"january": 1, "february": 2, "march":3, "april": 4, "may": 5, "june": 6, "july": 7, "august": 8, "september": 9, "october": 10, "november": 11, "december": 12 };
+
+let daysInMonth = new Date(2022, months[prompt('Enter Month').toLowerCase], 0).getDate();
+console.log(daysInMonth);
+
+
+
+
+
+
+
+
diff --git a/05_Day_Arrays/05_day_arrays.md b/05_Day_Arrays/05_day_arrays.md
index 0dae635..d0a8307 100644
--- a/05_Day_Arrays/05_day_arrays.md
+++ b/05_Day_Arrays/05_day_arrays.md
@@ -59,7 +59,7 @@ An array is a collection of different data types which are ordered and changeabl
### How to create an empty array
In JavaScript, we can create an array in different ways. Let us see different ways to create an array.
-It is very common to use _const_ instead of _let_ to declare an array variable. If you ar using const it means you do not use that variable name again.
+It is very common to use *const* instead of *let* to declare an array variable. If you ar using const it means you do not use that variable name again.
- Using Array constructor
@@ -400,7 +400,7 @@ if(index === -1){
// we can use also ternary here
index === -1 ? console.log('This fruit does not exist in the array'): console.log('This fruit does exist in the array')
-// let us check if an avocado exist in the array
+// let us check if a avocado exist in the array
let indexOfAvocado = fruits.indexOf('avocado') // -1, if the element not found index is -1
if(indexOfAvocado === -1){
console.log('This fruit does not exist in the array')
@@ -521,20 +521,18 @@ Splice: It takes three parameters:Starting position, number of times to be remov
```js
const numbers = [1, 2, 3, 4, 5]
- numbers.splice()
- console.log(numbers) // -> remove all items
+
+ console.log(numbers.splice()) // -> remove all items
```
```js
const numbers = [1, 2, 3, 4, 5]
- numbers.splice(0,1)
- console.log(numbers) // remove the first item
+ console.log(numbers.splice(0,1)) // remove the first item
```
```js
- const numbers = [1, 2, 3, 4, 5, 6]
- numbers.splice(3, 3, 7, 8, 9)
+ const numbers = [1, 2, 3, 4, 5, 6];
console.log(numbers.splice(3, 3, 7, 8, 9)) // -> [1, 2, 3, 7, 8, 9] //it removes three item and replace three items
```
@@ -546,6 +544,7 @@ Push: adding item in the end. To add item to the end of an existing array we use
// syntax
const arr = ['item1', 'item2','item3']
arr.push('new item')
+
console.log(arr)
// ['item1', 'item2','item3','new item']
```
@@ -553,6 +552,7 @@ console.log(arr)
```js
const numbers = [1, 2, 3, 4, 5]
numbers.push(6)
+
console.log(numbers) // -> [1,2,3,4,5,6]
numbers.pop() // -> remove one item from the end
@@ -562,6 +562,7 @@ console.log(numbers) // -> [1,2,3,4,5]
```js
let fruits = ['banana', 'orange', 'mango', 'lemon']
fruits.push('apple')
+
console.log(fruits) // ['banana', 'orange', 'mango', 'lemon', 'apple']
fruits.push('lime')
@@ -575,6 +576,7 @@ pop: Removing item in the end.
```js
const numbers = [1, 2, 3, 4, 5]
numbers.pop() // -> remove one item from the end
+
console.log(numbers) // -> [1,2,3,4]
```
@@ -585,6 +587,7 @@ shift: Removing one array element in the beginning of the array.
```js
const numbers = [1, 2, 3, 4, 5]
numbers.shift() // -> remove one item from the beginning
+
console.log(numbers) // -> [2,3,4,5]
```
@@ -595,6 +598,7 @@ unshift: Adding array element in the beginning of the array.
```js
const numbers = [1, 2, 3, 4, 5]
numbers.unshift(0) // -> add one item from the beginning
+
console.log(numbers) // -> [0,1,2,3,4,5]
```
@@ -605,6 +609,7 @@ reverse: reverse the order of an array.
```js
const numbers = [1, 2, 3, 4, 5]
numbers.reverse() // -> reverse array order
+
console.log(numbers) // [5, 4, 3, 2, 1]
numbers.reverse()
@@ -764,7 +769,7 @@ const webTechs = [
- Find the median age(one middle item or two middle items divided by two)
- Find the average age(all items divided by number of items)
- Find the range of the ages(max minus min)
- - Compare the value of (min - average) and (max - average), use _abs()_ method
+ - Compare the value of (min - average) and (max - average), use *abs()* method
1.Slice the first ten countries from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
1. Find the middle country(ies) in the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
2. Divide the countries array into two equal arrays if it is even. If countries array is not even , one more country for the first half.
diff --git a/05_Day_Arrays/05_day_starter/data/countries.js b/05_Day_Arrays/05_day_starter/data/countries.js
index e57b005..f7a1a66 100644
--- a/05_Day_Arrays/05_day_starter/data/countries.js
+++ b/05_Day_Arrays/05_day_starter/data/countries.js
@@ -1,4 +1,5 @@
const countries = [
+
'Afghanistan',
'Albania',
'Algeria',
diff --git a/05_Day_Arrays/05_day_starter/index.html b/05_Day_Arrays/05_day_starter/index.html
index 7d8eeea..40dbaf9 100644
--- a/05_Day_Arrays/05_day_starter/index.html
+++ b/05_Day_Arrays/05_day_starter/index.html
@@ -9,7 +9,7 @@
30DaysOfJavaScript:05 Day
Arrays
-
+