Manage your learning questions and answers
No answer yet
No answer yet
No answer yet
Function Declaration is declared with the function keyword, starting at the top level (not inside const or let) and it's Hoisted. While Function Expression is a function created and assigned to a variable, and only the variable declaration is hoisted, not the function itself.
{/* Function Declaration */}
function add(a, b) {
return a + b;
}
{/* Function Expression */}
const add = function(a, b) {
return a + b;
};
No answer yet
No answer yet
No answer yet
No answer yet
Use res.json to serialize objects as JSON.
app.get("/health", (req, res) => res.json({ ok: true }));
Use next/image for automatic optimization, sizing, and lazy loading.
import Image from "next/image";
<Image src="/banner.png" alt="banner" width={800} height={320} />;
Use import/export syntax; configure moduleResolution in tsconfig if needed.
import { readFile } from "node:fs/promises";
export const read = (p: string) => readFile(p, "utf8");
layout.tsx wraps route segments to provide shared UI (e.g., nav). page.tsx renders the actual page content for that route.