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

    Question 1Normal Function Declaration

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

    Question 2Arrow Function Syntax

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

    Question 3Anonymous Functions

    An anonymous function is a function that:

    Question 4Function Hoisting

    Which type of function gets hoisted completely in JavaScript?

    Question 5Function Expression Example

    Which of the following is a valid function expression?

    Question 6Scope of Variables

    Which variable has function scope in JavaScript?

    Question 7Arrow Function this Behavior

    What is special about this in arrow functions?

    Question 8IIFE (Immediately Invoked Function Expression)

    Which syntax correctly represents an IIFE?

    Question 9JS Default Parameters

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

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

    Question 10Hoisting with Function Expressions

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

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