Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM
Practice: DocumentFragment and localStorage
Use DocumentFragment for efficient element addition and localStorage for saving configuration
Task
The index.html file has three functions: renderDinosaurs(names) adds dinosaurs to the #dino-list list, saveConfig(config) saves the settings in localStorage under the parkConfig key, and loadConfig() reads them (without a saved value it returns { theme: "jungle" }). Fill in the blanks: ___BLANK1___ is the document method that creates a DocumentFragment, ___BLANK2___ is the expression that turns the config object into JSON text, and ___BLANK3___ is the expression that turns the raw text back into an object. The list should be filled with one appendChild call with the fragment, and a saved object should come back from loadConfig() unchanged.