Question 1:
Create a simple HTML + JavaScript page that:
Has an input box and a button saying “Greet Me”.
When the button is clicked, it should display a greeting message (Hello, <name>!) below
the button using template literals.
Use let/const appropriately (no var).
Write the event handler as an arrow function.
Add a higher-order function that takes a function as input (for example, a wrapper
function that logs the time whenever a function is executed). Use it to wrap the event
handler.
Question. 2:
You are given the following dummy data of users:
const users = [
{ id: 1, name: "Alice", age: 24, skills: ["JS", "React"] },
{ id: 2, name: "Bob", age: 30, skills: ["Java", "Spring"] },
{ id: 3, name: "Charlie", age: 28, skills: ["Python", "Django", "React"] },
];
Tasks:
Use array methods (map, filter, reduce) to:
List all users who know React.
Create an array of just user names.
Find the average age of users.
Use object & array destructuring to extract user details.
Add a new user object using the spread operator without mutating the original array.
Create a function that accepts ...skills as rest parameters and logs them.
Question.3:
Build a small app that fetches dummy data and displays it.
Create two JS files ([Link] and [Link]).
In [Link], write a function fetchPosts that uses fetch with async/await to get posts from:
👉 [Link]
and export it using ES modules (export).
In [Link], import fetchPosts and use it.
Display the first 5 post titles inside an HTML list (<ul>).
Add a loading message (Loading...) that disappears once the data is fetched.
Handle errors using try...catch.
Write a small demo (in console) to explain how the event loop handles async/await in
your code.