Skip to content

Instantly share code, notes, and snippets.

@nabily4e-dev
Created January 12, 2023 17:21
Show Gist options
  • Save nabily4e-dev/0e168d1a0519feb8ae254e7f61f4e5ef to your computer and use it in GitHub Desktop.
Save nabily4e-dev/0e168d1a0519feb8ae254e7f61f4e5ef to your computer and use it in GitHub Desktop.
const numbers = [1, 2, 3, 4, 5];
const words = ['Call', 'me', 'to', 'the', 'moon'];
const doubledNumbers = numbers.map(function(number) {
return number * 2;
});
console.log(doubledNumbers);
const newWords = ['hello', 'world', 'goodbye', 'moon'];
const uppercaseWords = newWords.map(function(word) {
return word.toUpperCase();
});
console.log(uppercaseWords);
const values = [1, 4, 9, 16, 25];
const squaredValues = values.map(function(value) {
return value * value;
});
console.log(squaredValues);
const halfValues = values.map(function(value) {
return value / 2;
});
console.log(halfValues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment