Skip to content

colorlessenergy/formatthestring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

formatthestring

task algorithm practice

Given: an array containing hashes of names

Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.

Example:

list([ {name: 'Bart'}, {name: 'Lisa'}, {name: 'Maggie'} ]) // returns 'Bart, Lisa & Maggie'

list([ {name: 'Bart'}, {name: 'Lisa'} ]) // returns 'Bart & Lisa'

list([ {name: 'Bart'} ]) // returns 'Bart'

list([]) // returns '' Note: all the hashes are pre-validated and will only contain A-Z, a-z, '-' and '.'.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published