Katkat

Implement map and render to DOM

LinkedInSoftware Engineer · HR Screen

Last updated

This question evaluates a candidate's skills in vanilla JavaScript utility implementation and DOM rendering, covering array and plain-object iteration semantics, higher-order functions, input validation, error handling, and safe text rendering for browser environments.

Using only vanilla JavaScript in a script tag, implement a function similar to Array.prototype.map (without using the built-in map) to transform a list (array or key–value dictionary) of objects. Then render one div per transformed item into the DOM with appropriate classes/attributes and handle empty/error states. Do not use any frameworks.