JavaScript Taskbook Level 8.4
Given a button and a block with text. The text does not fit into the block in height and is hidden. Click on the button to expand the block to its full height.
Given a string of text, get the percentage of each character in the text as an object where the keys are the characters and the values are their percentages.
Given a list of ul and an input. As you type text into the input, leave visible only those li whose text begins with the text entered into the input.
Display the following pyramid on the screen:
1
22
333
4444
55555
666666
7777777
88888888
999999999
22
333
4444
55555
666666
7777777
88888888
999999999
Given a list of cities and their countries, stored in the following structure:
let data = [
{
country: 'country1',
city: 'city11',
},
{
country: 'country2',
city: 'city21',
},
{
country: 'country3',
city: 'city31',
},
{
country: 'country1',
city: 'city12',
},
{
country: 'country1',
city: 'city13',
},
{
country: 'country2',
city: 'city22',
},
{
country: 'country3',
city: 'city31',
},
]
Write code that will remake the data structure into this:
{
'country1': [
'city11', 'city12', 'city13',
],
'country2': [
'city21', 'city22'
],
'country3': [
'city31', 'city32'
],
}