For these two questions please provide strictly client-side solutions.
- Key Counts
Create an html page with a text-area and a button to sum up key counts in the text area. Each line of the text area is expected to contain data in the format of 'key, count' where the count is parse-able into an integer. The text area should have the following default value:
'John,2
Jane,3
John,4
Jane,5'
When the button is pressed the results of the summation should be displayed.
The default value should result in the output: 'The total for John is 6. The total for Jane is 8.'
Example Input:
bill,45
alf, 31
anthony, 54
alf, 75
spaceship, 98
spaceship, 45
train, 500
car, 400
trash,234
butter, 45354
van, 9898
street, 5
train, 500
car, 400