Description: A List of Highend Phones with a collapse button that reveals the options on click event - when the user clicks on the button.
Hint: Make the console your friend
Call the startApp function before the closing script tag (</script>).
Create a new variable phoneList inside the startApp function, the value should be an empty Array [].
Inside the for loop, çall the createList function with the model variable as the argument.
The
createListfunction returns aNode
Assign the createList function to the listEl variable, and push the variable to phoneList array.
After the for loop invoke the addToList function with the phoneList variable as an argument.
In the createList function, set a parameter phone_name. Using document.createElement, create a li element, assign it to a listEl variable, add a class of fancy__list to the listEl.
Before the return statement, invoke the activeToggleButton function with the listEl as an argument .
activeToggleButtonadds the click event listener to the.toggle-btninside thelistEl. TheactiveToggleButtondoesn't have a return value.
At this point you should see a list of all the phones in the
PHONE_MODELSarray. But the togglebuttonwon't work.
In the activeToggleButton function, add a click event to arrowButton variable. On click of the arrowButton the toggleAction function should be called.
Add some models to the PHONE_MODELS array, to see if it's dynamic.