Home
Javascript Fundamentals
# Javascript basics
# Javascript arrays
# Javascript objects
# Javascript dates
# Javascript Sets
Javascript DOM
# DOM selector methods
# Events and user interactions
# DOM manipulation
# DOM fundamentals
# Recursive functions
Challenge Rush
Random Challenge
// Write a function that takes an array of strings as argument// Group those strings by their first letter// Return an object that contains properties with keys representing first letters// The values should be arrays of strings containing only the corresponding strings// For example, the array ['Alf', 'Alice', 'Ben'] should be transformed to// { a: ['Alf', 'Alice'], b: ['Ben']} function myFunction ( arr ) { return }
return
myFunction(['Alf', 'Alice', 'Ben'])
{ a: ['Alf', 'Alice'], b: ['Ben']}
myFunction(['Ant', 'Bear', 'Bird'])
{ a: ['Ant'], b: ['Bear', 'Bird']}
myFunction(['Berlin', 'Paris', 'Prague'])
{ b: ['Berlin'], p: ['Paris', 'Prague']}