Blog

Interview

JS

Javascript interview questions

Javascript interview questions

Ragav Kumar V

Ragav Kumar V

Jan 12, 2023 ยท 2 min read


_8
function x() {
_8
setTimeout(() => {
_8
console.log(i);
_8
}, 1000);
_8
var i = 1;
_8
}
_8
_8
x();

Answer

_1
1


_8
console.log(1);
_8
setTimeout(function () {
_8
console.log(2);
_8
}, 1000);
_8
setTimeout(function () {
_8
console.log(3);
_8
}, 0);
_8
console.log(4);

Answer

_1
1


_32
const data = [
_32
{
_32
name: "Menu 1",
_32
link: "http://gooogle.com",
_32
subitems: [
_32
{
_32
name: "Menu 2",
_32
link: "http://gooogle.com",
_32
},
_32
],
_32
},
_32
{
_32
name: "Menu 3",
_32
link: "http://gooogle.com",
_32
subitems: [
_32
{
_32
name: "Menu 4",
_32
link: "http://gooogle.com",
_32
subitems: [
_32
{
_32
name: "Menu 5",
_32
link: "http://gooogle.com",
_32
},
_32
{
_32
name: "Menu 6",
_32
link: "http://gooogle.com",
_32
},
_32
],
_32
},
_32
],
_32
},
_32
];

  • What is Hoisting in JS and How it works?
  • What is the difference between let and var?
  • What is Event Loop?
  • What is precedence in Event Loop?
  • What is the difference between setTimeout and setInterval?
  • Where do you use Rest Operator?
  • Have you heard of array.reverse()?
  • What is meant by Shallow copy and Deep copy?
  • What is Closure?
  • Have you used reduce function in JS?
  • What is the difference between map and reduce?
  • What are the parameters the map function accepts?
  • What is the difference between a Promise and a Callback?
  • What position property in CSS have you used and what is the difference between them?
  • What is Flexbox?
  • What is the difference between display:none and visibility:hidden?
  • What is Memoization?
  • How do you ensure your code has high quality?
  • Vercel, AWS S3
  • CI/CD Tool?

Write the implementation of the product function for the below test to pass


_2
product(4, 5); // 20
_2
product(4)(5); // 20

@ragavkumarv
swipe to next โžก๏ธ