Continuando exercício 1

pull/105/head
Felipe Lobo 5 years ago
parent ea6790666a
commit f578b6a766

@ -1,28 +1,4 @@
// Exercise: Level 1 // Exercise: Level 1 - Arrays
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; // Declare an empty array;
const emptyArray = []; const emptyArray = [];
@ -72,9 +48,14 @@ for (let i = 0; i < itCompanies.length; i++) {
console.log(companies); console.log(companies);
// Print the array like as a sentence: Facebook, Google, Microsoft, Apple, IBM,Oracle and Amazon are big IT companies. // Print the array like as a sentence: Facebook, Google, Microsoft, Apple, IBM,Oracle and Amazon are big IT companies.
console.log(`${itCompanies[0]}, ${itCompanies[1]}, ${itCompanies[2]}, ${itCompanies[3]}, ${itCompanies[4]}, ${itCompanies[5]}, and ${itCompanies[6]} 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 // Check if a certain company exists in the itCompanies array. If it exist return the company else return a company is not found
let companyIndex = itCompanies.indexOf(company);
companyIndex === -1 ? console.log(`${company} is not found.`) : console.log(`${company}`)
// Filter out companies which have more than one 'o' without the filter method // Filter out companies which have more than one 'o' without the filter method
// Sort the array using sort() method // Sort the array using sort() method

Loading…
Cancel
Save