From d70c5484fdaaafc2fe3d69e21d4519153a6828c5 Mon Sep 17 00:00:00 2001 From: AdeSanyaOlu Date: Thu, 16 Sep 2021 09:33:50 -0700 Subject: [PATCH] ... --- 05_Day_Arrays/05_day_starter/scripts/main.js | 33 ++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/05_Day_Arrays/05_day_starter/scripts/main.js b/05_Day_Arrays/05_day_starter/scripts/main.js index 50cc07e..7acf354 100644 --- a/05_Day_Arrays/05_day_starter/scripts/main.js +++ b/05_Day_Arrays/05_day_starter/scripts/main.js @@ -1,3 +1,32 @@ console.log(countries) -alert('Open the browser console whenever you work on JavaScript') -alert('Open the console and check if the countries has been loaded') \ No newline at end of file +//alert('Open the browser console whenever you work on JavaScript') +//alert('Open the console and check if the countries has been loaded') +/* const arr = Array() // creates an an empty array +console.log(arr) + +const eightEmptyValues = Array(8) // it creates eight empty values +console.log(eightEmptyValues) // [empty x*/ + +const arr = [1, 3, 4, "Forward", "Here"]; +let lastIndex = arr.length-1 +console.log (arr[lastIndex]); +/* +Declare an array called mixedDataTypes, put different data types in the array and find the length of the array. The array size should be greater than 5 +Declare an array variable name itCompanies and assign initial values Facebook, Google, Microsoft, Apple, IBM, Oracle and Amazon +Print the array using console.log() +Print the number of companies in the array +Print the first company, middle and last company +Print out each company */ +const mixedDataTypes = ["string", NaN, 40, 40.5, "dear"]; +console.log(mixedDataTypes.length) + +const itCompanies = ["Facebook", "Google", "Microsoft", "Apple", "IBM","Oracle", "Amazon" ] +let lastItCompany = itCompanies.length-1; +console.log(itCompanies); +console.log(itCompanies.length); +console.log(itCompanies[0]); +console.log(itCompanies[3]); +console.log(itCompanies[lastItCompany]); +let uppercase = itCompanies.toUpperCase[0]; +console.log (uppercase) +// new line