Skip to content

Instantly share code, notes, and snippets.

View Sanad-Alshobaki's full-sized avatar

Sanad Alshobaki Sanad-Alshobaki

View GitHub Profile
@Sanad-Alshobaki
Sanad-Alshobaki / gist:ea103debdbb36668c31d7be08c0e12f3
Created October 5, 2023 16:36 — forked from TessMyers/gist:a252520dd9a8fe68f8e5
Simple exercises using .map and .reduce
// Simple problems to solve using the native .reduce and .map array methods. Each of these problems can be solved in many
// different ways, but try to solve them using the requested higher order function.
// MAP
// Write a function capitalize that takes a string and uses .map to return the same string in all caps.
// ex. capitalize('whoop') // => 'WHOOP'
// ex. capitalize('oh hey gurl') // => "OH HEY GURL"
var capitalize = function(string){
// code code code!