Day 1: Variables, Scope & Hoisting

Core Questions:

  1. What are the differences between var, let, and const?
  2. Explain hoisting in JavaScript
  3. What is scope in JavaScript? Explain different types of scope

Output-Based Questions:

// Q1: What will be the output?
console.log(x);
var x = 5;
console.log(x);

// Q2: What will be the output?
console.log(a);
let a = 10;

// Q3: What will be the output?
function test() {
  console.log(y);
  var y = 20;
}
test();

// Q4: What will be the output?
let x = 10;
{
  console.log(x);
  let x = 20;
}

// Q5: What will be the output?
const obj = { name: 'John' };
obj.name = 'Jane';
console.log(obj.name);
obj = { name: 'Bob' }; // What happens?


Day 2: Data Types & Type Coercion

Core Questions:

  1. What are the primitive and non-primitive data types in JavaScript?
  2. Explain type coercion in JavaScript
  3. What is NaN? How do you check if a value is NaN?

Output-Based Questions:

// Q1: What will be the output?
console.log(typeof null);
console.log(typeof undefined);
console.log(typeof NaN);

// Q2: What will be the output?
console.log(1 + "2" + "2");
console.log(1 + +"2" + "2");
console.log(1 + -"1" + "2");

// Q3: What will be the output?
console.log("5" - 3);
console.log("5" + 3);
console.log([] + []);
console.log([] + {});
console.log({} + []);

// Q4: What will be the output?
console.log(0 == false);
console.log(0 === false);
console.log("" == false);
console.log("" === false);

// Q5: What will be the output?
console.log(null == undefined);
console.log(null === undefined);


Day 3: Functions & Execution Context

Core Questions:

  1. What are the different ways to create functions in JavaScript?
  2. Explain the execution context in JavaScript