Predict the output:
console.log("20" - 5 + "10");
What is the final output?
var a = "10";
var b = 5;
console.log(a * b + a);
Identify the error (if any):
const a = 10;
{
const a = 20;
console.log(a);
}
console.log(a);
What kind of error will occur?
const x;
x = 100;
What will happen?
console.log(b);
var b = 10;
Write logic to swap two numbers?
Predict the output
var x = "10";
var x = 10;
console.log(x + 5);
What will be printed?
var a = 5;
if (true) {
var a = 10;
}
console.log(a);
Will this code run successfully? If yes, what is the output?
var a;
console.log(a);
a = 100;
Write logic to calculate the sum of four numbers using currying?
What is the main difference between forEach and map?
What is the difference in iteration behavior between a normal loop and a for…in loop when an array has missing elements?
Write a program to find the sum of all array elements using reduce?
Write a program to check whether a value exists in an array?
What will be printed?
const arr = [12, "12", 15];
const result = arr.filter((ele) => ele === 12);
console.log(result);
Which loop skips empty elements and why?
const arr = [ , 2, , 4];
How can object values be accessed?
What will be the output?
const user = {
name: "A",
age: 25,
age : 32
};
console.log(user.age);
What will be the output?
const obj = {
info: {
city: "Ahmedabad"
}
};
console.log(obj.info2);
What will be the output, if any error then how do handle it?
const obj = {
info: {
city: "Ahmedabad"
}
};
console.log(obj.info2.city);
What will be the output?
const obj = {
id: 10,
show: () => {
return this.id;
}
};
console.log(obj.show());
Write a program to add new properties to an object?
What will be the output?
localStorage.setItem("count", 10);
localStorage.setItem("count", 20);
console.log(localStorage.getItem("count"));
What will be the output? If any error then how to handle it
localStorage.setItem("user", { name: "A" });
console.log(localStorage.getItem("user"));
What will be the output?
console.log("start");
setTimeout(() => {
console.log("timeout");
}, 0);
console.log("end");
what is API and to write a API Method with syntax?
Top comments (0)