TGViewer
Web Development - HTML, CSS & JavaScript Web Development - HTML, CSS & JavaScript @javascript_courses · 55.7K subscribers
Post #3460 2.24K
function greet(name, callback) {
console.log("Hello " + name);
callback();
}

function done() {
console.log("Completed");
}


• greet("Deepak", done);

Output:

• Hello Deepak

• Completed

🚀 14. Higher Order Functions

Higher Order Functions -> functions that:

• Accept functions as arguments

• Return functions

Example:

function operation(callback) {
callback();
}


• operation(() => {

console.log("Executed");

});

⚡ 15. Closures

Closures -> one of the most important interview topics.

A closure -> allows a function to remember variables from its outer scope.

Example:

function counter() {
let count = 0;
return function() {
count++;
console.log(count);
};
}

const increment = counter();


• increment();

• increment();

Output:

• 1

• 2

🎯 16. Recursive Functions

Recursive -> a function calling itself.

Example:

function countdown(n) {
if(n === 0) {
return;
}
console.log(n);
countdown(n - 1);
}


• countdown(5);

Output:

• 5

• 4

• 3

• 2

• 1

🧮 17. Practical Example — Sum of Array

function sumArray(arr) {
return arr.reduce((sum, num) => sum + num, 0);
}


console.log(sumArray([1, 2, 3]));

Output:

• 6

⭐ Important Interview Topics

Focus heavily on:

• 🔥 Function Declaration

• 🔥 Function Expression

• 🔥 Arrow Functions

• 🔥 Scope

• 🔥 Closures

• 🔥 Callback Functions

• 🔥 Higher Order Functions

• 🔥 Recursion

• 🔥 Hoisting

📝 Mini Practice Questions

Easy

• ✅ Create calculator function

• ✅ Find maximum of two numbers

• ✅ Check even or odd

Medium

• ✅ Reverse string

• ✅ Find factorial

• ✅ Check palindrome

Advanced

• ✅ Implement debounce

• ✅ Implement throttle

• ✅ Create custom map() function

Double Tap ❤️ For More
  • 👍 6
  • ❤ 4
More from @javascript_courses
  1. Oct 8, 2026🎓 𝗠𝗶𝗰𝗿𝗼𝘀𝗼𝗳𝘁 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝘄𝗶𝘁𝗵 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗲𝘀! 🚀🔥 Upgr…
  2. Oct 7, 2026🚀𝗣𝗮𝘆 𝗔𝗳𝘁𝗲𝗿 𝗣𝗹𝗮𝗰𝗲𝗺𝗲𝗻𝘁 𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 | 𝗕𝗲𝗰𝗼𝗺𝗲 𝗮 𝗙𝘂𝗹𝗹𝘀𝘁𝗮𝗰…
  3. Oct 7, 2026𝗠𝗮𝘀𝘁𝗲𝗿 𝗣𝗼𝘄𝗲𝗿 𝗕𝗜 𝗳𝗼𝗿 𝗙𝗥𝗘𝗘! 🔥 Learn Power BI through these FREE learnin…
  4. Oct 4, 2026DSA Handwritten Notes
  5. Sep 28, 2026To learn web design and development from basic to advanced levels, you can follow these st…
  6. Sep 27, 202610 Websites Every Developer & AI Enthusiast Should Bookmark ✅ roadmap.sh – Step-by-step le…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →