const companies = [
{
name: 'Amazon',
founded: 1994,
industry: 'E-Commerce, Cloud'
},
{
name: 'Alphabet Inc.',
founded: 2015,
industry: 'Search, Cloud, Advertising'
},
{
name: 'Facebook',
founded: 2004,
industry: 'Social'
}
]
console.table(companies)
const companies = [
{
name: 'Amazon',
founded: 1994,
industry: 'E-Commerce, Cloud'
},
{
name: 'Alphabet Inc.',
founded: 2015,
industry: 'Search, Cloud, Advertising'
},
{
name: 'Facebook',
founded: 2004,
industry: 'Social'
}
]
console.table(companies, ["name", "founded"])
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
console.time('testFor')
for(let x = 0 ; x < array.length; x++) {
array[x]
}
console.timeEnd('testFor')
console.time('testForOf')
for(let x of array) {
x
}
console.timeEnd('testForOf')
console.time('testForEach')
array.forEach(x => x)
console.timeEnd('testForEach')
testFor: 0.04296875ms
testForOf: 0.108154296875ms
testForEach: 0.083984375ms