Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
483 B
0
Indexable
Never
let creatures = ['Dragon', 'Cthulhu', 'Shark'];

creatures.forEach(function(creature) {
  console.log(creature + ' is one of the scariest creatures.');
});

let numbers = [5, 6, 7, 8, 9];

let doubleNumber = numbers.map(function(number) {
  return number * 2;
});

console.log(doubleNumber);

let things = ['Pencil', 'Hat', 2, 'Glasses', 7, 76];

let numbersOnly = things.filter(function(thing) {
  return typeof thing === 'number';
});

console.log(numbersOnly);