Interview Question

What are functions in JavaScript?

Functions are callable first-class objects.

💡 Concept ✅ Quick Revision ⚡ JavaScript

Answer

A JavaScript function is a callable object containing executable code. • Functions can receive parameters and return a value. • They are first-class values and can be stored or passed to other functions. • Each call creates an execution context with its own bindings.

Example

Code
function add(a, b) {
  return a + b;
}
console.log(add(2, 3));
Output
5

Quick Revision

Functions are callable first-class objects.