xxxxxxxxxx
// Common JavaScript Interview Questions and Answers
// 1. What is a closure in JavaScript?
// Answer:
// A closure is an inner function that has access to the outer (enclosing) function's variablesâ••scope chain even after the outer function has returned.
// 2. What is the difference between 'undefined' and 'null'?
// Answer:
// 'undefined' is a value that indicates something is not assigned to a variable. 'null' is a value that represents the intentional absence of an object value.
// 3. How does JavaScript handle asynchronous operations?
// Answer:
// JavaScript uses callbacks, promises, and async/await to handle asynchronous operations. Callbacks are the traditional way, promises provide a more structured approach, and async/await is a more recent syntax that simplifies working with promises.
// ... (Add more questions and answers as needed)
xxxxxxxxxx
1
2
3
4
5
6
function func(x){
console.log(typeof x, arguments.length);
}
func(); //==> "undefined", 0
func(7); //==> "number", 1
func("1", "2", "3"); //==> "string", 3