0% found this document useful (0 votes)
8 views1 page

Top 50 JavaScript Interview Questions With Answers

JavaScript is a lightweight, interpreted programming language used for web development, differing from Java in being dynamically typed and interpreted. It includes various data types such as primitive types (string, number, boolean, etc.) and non-primitive types (object, array, function). Key concepts discussed include variable scoping (let, const, var), hoisting, and closures.

Uploaded by

Raunak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Top 50 JavaScript Interview Questions With Answers

JavaScript is a lightweight, interpreted programming language used for web development, differing from Java in being dynamically typed and interpreted. It includes various data types such as primitive types (string, number, boolean, etc.) and non-primitive types (object, array, function). Key concepts discussed include variable scoping (let, const, var), hoisting, and closures.

Uploaded by

Raunak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q: What is JavaScript, and how is it different from Java?

JavaScript is a lightweight, interpreted programming language primarily used for web development.
Unlike Java, which is compiled and strongly typed, JavaScript is interpreted and dynamically typed.
[Link]('Hello, JavaScript!');

Q: What are data types available in JavaScript?


Primitive types include string, number, boolean, undefined, null, bigint, and symbol. Non-primitive:
object, array, function.
let str = 'Hello'; let num = 10; let obj = {};

Q: Difference between let, const, and var?


`var` is function-scoped, `let` and `const` are block-scoped. `const` cannot be reassigned.
var a=1; let b=2; const c=3;

Q: What is hoisting?
Hoisting moves declarations to the top of their scope before code execution.
[Link](a); var a = 5; // undefined

Q: What is a closure?
A closure gives a function access to variables from its parent scope even after that scope has
closed.
function outer(){let x=10;return function(){[Link](x);}} const
inner=outer(); inner();

...and more (Total 50 Questions with detailed code examples).

You might also like