Functions (normal, arrow, anonymous, scope) Interview Questions

    Question 1: Normal Function Declaration

    Which of the following correctly declares a normal function in JavaScript?

    Question 2: Arrow Function Syntax

    Which is the correct syntax of an arrow function that returns the sum of a and b?

    Question 3: Anonymous Functions

    An anonymous function is a function that:

    Question 4: Function Hoisting

    Which type of function gets hoisted completely in JavaScript?

    Question 5: Function Expression Example

    Which of the following is a valid function expression?

    Question 6: Scope of Variables

    Which variable has function scope in JavaScript?

    Question 7: Arrow Function this Behavior

    What is special about this in arrow functions?

    Question 8: IIFE (Immediately Invoked Function Expression)

    Which syntax correctly represents an IIFE?

    Question 9: JS Default Parameters

    What will greet("Alice") print if the function is defined as:

    function greet(name = "Guest") { console.log(name); }

    Question 10: Hoisting with Function Expressions

    What happens if you call a function expression before it is defined?

    greet(); var greet = function() { console.log("Hello"); };