Part 9–100 Advanced JavaScript Interview Questions with Answers and Code Examples
Welcome to the ninth part of our series on advanced JavaScript interview questions!
Introduction:
In this article, we’ll continue exploring ten more challenging questions that will test your knowledge of JavaScript concepts and techniques. Each question is accompanied by a detailed answer and code examples to help you understand the topic thoroughly. Additionally, we’ll provide external links for further reading to enhance your understanding. Let’s dive in!
81- What is the difference between “undefined” and “null” in JavaScript? Provide an example.
Answer: In JavaScript, undefined
is a value that indicates the absence of a value or an uninitialized variable, while null
is an assignment value that represents the intentional absence of any object value. Here's an example:
let x;
console.log(x); // Output: undefined
const y = null;
console.log(y); // Output: null
Further Reading: MDN Web Docs — undefined and MDN Web Docs — null