JavaScript Fundamentals + HR Questions

Deven RikameDeven Rikame
3 min read

1. What are the differences between var, let, and const in JavaScript?

Answer:

  • var: function-scoped, hoisted, can be redeclared.

  • let: block-scoped, cannot be redeclared in the same scope, but can be reassigned.

  • const: block-scoped, cannot be redeclared or reassigned.

2. What is hoisting in JavaScript?

Answer: Hoisting is the process where JavaScript moves variable and function declarations to the top of their scope before execution.

console.log(a); // undefined
var a = 10;

3. What is the difference between == and ===?

Answer:

  • ==: checks value only (performs type coercion).

  • ===: checks value and type (strict comparison).

5 == "5" // true
5 === "5" // false

4. What are closures in JavaScript?

Answer: A closure is a function that remembers variables from its outer scope, even after the outer function has finished executing.

function outer() {
  let count = 0;
  return function inner() {
    count++;
    return count;
  };
}
const counter = outer();
console.log(counter()); // 1

5. Explain synchronous vs asynchronous JavaScript.

Answer:

  • Synchronous: Code runs line by line; next line waits until the current one finishes.

  • Asynchronous: Code executes without blocking (using callbacks, promises, async/await).

6. What is event delegation?

Answer: Event delegation is attaching a single event listener to a parent element to manage events for multiple child elements using event bubbling.
Example:

document.getElementById("list").addEventListener("click", (e) => {
    if (e.target.tagName === "LI")
    console.log("LI clicked:", e.target.innerText);
})

7. What are promises in JavaScript?

Answer: A Promise represents the eventual completion (or failure) of an asynchronous operation.

const p = new Promise((resolve, reject) => {
  setTimeout(() => resolve("Success!"), 1000);
});

8. Why do we use async/await?

Answer: It makes asynchronous code easier to read and maintain, avoiding callback hell.

async function fetchData() {
  try {
    const data = await fetch("api.com/data");
    console.log(await data.json());
  } catch (err) {
    console.error(err);
  }
}

9. HR Q: Tell me about yourself (as a B.Com graduate moving into software).

Answer (Sample for someone from commerce background):
“I graduated with a B.Com in 2022, but along the way, I found my real passion in technology. I taught myself full-stack development (MERN + Next.js + TypeScript) and built multiple projects including a portfolio with custom email API integration. My commerce background adds business acumen, while my coding projects prove my technical skills. I am eager to bring this unique mix into a professional software development role.”

10. HR Q: Why should we hire you despite being from a non-CS background?

Answer:
“My strength lies in adaptability and persistence. I come from commerce, so I bring problem-solving and analytical thinking from that domain. But I also worked hard to build strong technical skills in JavaScript, React, Node, and databases through projects and practice. This shows I can learn quickly, adapt to new challenges, and deliver value like any CS graduate.”

0
Subscribe to my newsletter

Read articles from Deven Rikame directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Deven Rikame
Deven Rikame

Full-Stack Developer specializing in MERN, Next.js, and TypeScript with a strong focus on building scalable, responsive, and user-friendly applications. Experienced in integrating custom APIs, deploying production-ready solutions, and writing clean, maintainable code. Passionate about problem-solving, open source, and continuous learning.