JavaScript Arrays Interview Questions

    Question 1Array Type

    What is the result of typeof [] in JavaScript?

    Question 2Array Length Property

    What will be the output of:

    let arr = [1, 2, 3]; console.log(arr.length);

    Question 3Adding Elements with push()

    What is the result of:

    let arr = [1, 2]; arr.push(3); console.log(arr);

    Question 4Removing Last Element

    What is the result of:

    let arr = [1, 2, 3]; arr.pop(); console.log(arr);

    Question 5Removing First Element

    What is the result of:

    let arr = [10, 20, 30]; arr.shift(); console.log(arr);

    Question 6Adding First Element

    What is the result of:

    let arr = [20, 30]; arr.unshift(10); console.log(arr);

    Question 7Array Includes Check

    What will be the result of:

    let arr = [1, 2, 3]; console.log(arr.includes(2));

    Question 8IndexOf Method

    What will be the result of:

    let arr = ["a", "b", "c"]; console.log(arr.indexOf("b"));

    Question 9Array isArray Method

    What is the result of:

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

    Question 10Array Concatenation

    What will be the result of:

    let a = [1, 2]; let b = [3, 4]; console.log(a.concat(b));