Palo Alto Interview Question: Implement Lazy Loading with Dynamic Content Injection

13 Views
No Comments

Problem Description (Original)

1. Problem

You are given a simple web page layout with a navigation menu:

Home   Products   About us

The page initially loads only the basic structure.


2. Solution / Requirement

Implement lazy loading, where content is loaded only when needed, instead of loading everything at page initialization.

You are also required to add content dynamically to the page using a JavaScript function.


Example: Function to Add Content Dynamically

<div>
  <h1>name</h1>
  <p>your name here</p>
</div>

The function should dynamically create and insert this content into the DOM at runtime.


This question tests front-end fundamentals around lazy loading and dynamic DOM manipulation.
Candidates are expected to understand when content should be loaded, how to inject HTML dynamically, and how to avoid unnecessary initial page rendering.

END
 0