Hillary Chege
Crafting Digital Excellence

Code Snippets

Useful code examples and solutions I've collected. Feel free to use and learn from them!

array_map_in_javascript.js ×

// Array Map in JavaScript

// Transform array elements using the map function

const numbers = [1, 2, 3, 4, 5];
const doubled = numbers.map(num => num * 2);
console.log(doubled); // [2, 4, 6, 8, 10]