diff --git a/Test/01-js-refresher.js b/Test/01-js-refresher.js new file mode 100644 index 0000000..2589c20 --- /dev/null +++ b/Test/01-js-refresher.js @@ -0,0 +1,54 @@ +// Exercise: Level 1 + +const countries = [ + 'Albania', + 'Bolivia', + 'Canada', + 'Denmark', + 'Ethiopia', + 'Finland', + 'Germany', + 'Hungary', + 'Ireland', + 'Japan', + 'Kenya', +] + +const webTechs = [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Redux', + 'Node', + 'MongoDB', +] +// Declare an empty array; +const emptyArray = [] +// Declare an array with more than 5 number of elements +const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] +// Find the length of your array +console.log(numbers.length) +// Get the first item, the middle item and the last item of the array +console.log(numbers[0], numbers[Math.floor(numbers.length / 2)], numbers[numbers.length - 1]) +// 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 +const mixedDataTypes = [1, 'two', true, { name: 'John' }, [1, 2, 3, 4, 5]] +// Declare an array variable name itCompanies and assign initial values Facebook, Google, Microsoft, Apple, IBM, Oracle and Amazon +const itCompanies = ['Facebook', 'Google', 'Microsoft', 'Apple', 'IBM', 'Oracle', '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 +// Change each company name to uppercase one by one and print them out +// Print the array like as a sentence: Facebook, Google, Microsoft, Apple, IBM,Oracle and Amazon are big IT companies. +// Check if a certain company exists in the itCompanies array. If it exist return the company else return a company is not found +// Filter out companies which have more than one 'o' without the filter method +// Sort the array using sort() method +// Reverse the array using reverse() method +// Slice out the first 3 companies from the array +// Slice out the last 3 companies from the array +// Slice out the middle IT company or companies from the array +// Remove the first IT company from the array +// Remove the middle IT company or companies from the array +// Remove the last IT company from the array +// Remove all IT companies \ No newline at end of file diff --git a/Test/1.jsx b/Test/1.jsx deleted file mode 100644 index e69de29..0000000