Javascript Flashcards

1
Q

What is the output of ‘typeof null’ in JavaScript?

A

object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: JavaScript is a compiled language.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Fill in the blank: In JavaScript, _____ are used to define a block of code that can be executed later.

A

functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does ‘=== ‘ do in JavaScript?

A

It checks for both value and type equality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are JavaScript closures?

A

Functions that have access to the outer function’s scope even after the outer function has returned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which method is used to convert a JSON string into a JavaScript object?

A

JSON.parse()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What will the following code output: console.log(0.1 + 0.2 === 0.3)?

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the ‘this’ keyword in JavaScript?

A

It refers to the object that is currently executing the function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

True or False: JavaScript supports multiple inheritance.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a promise in JavaScript?

A

An object that represents the eventual completion or failure of an asynchronous operation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which symbol is used to create an object in JavaScript?

A

{}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What will be the output of the following code: console.log(typeof NaN)?

A

number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Fill in the blank: JavaScript is primarily used for _____ in web development.

A

client-side scripting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the ‘map’ method do in JavaScript?

A

It creates a new array populated with the results of calling a provided function on every element in the calling array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the difference between ‘let’ and ‘var’ in JavaScript?

A

‘let’ has block scope, while ‘var’ has function scope.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are template literals in JavaScript?

A

String literals allowing embedded expressions, enclosed by backticks (``).

17
Q

What is the use of ‘async’ and ‘await’ in JavaScript?

A

They are used to work with asynchronous code, making it easier to read and write.

18
Q

Which operator is used to destructure an array in JavaScript?

19
Q

What is the output of ‘[] + []’ in JavaScript?

20
Q

True or False: Arrow functions do not have their own ‘this’ context.

21
Q

What is the purpose of the ‘bind’ method in JavaScript?

A

It creates a new function that, when called, has its ‘this’ keyword set to the provided value.

22
Q

What will the following code output: console.log(‘5’ - 2)?

23
Q

What is event delegation in JavaScript?

A

A technique that allows you to attach a single event listener to a parent element to manage events for multiple child elements.

24
Q

Fill in the blank: In JavaScript, _____ are variables that can hold multiple values.

25
What is the purpose of the 'reduce' method in JavaScript?
It executes a reducer function on each element of the array, resulting in a single output value.
26
What does 'JSON.stringify()' do in JavaScript?
It converts a JavaScript object or value to a JSON string.
27
Which keyword is used to declare a constant in JavaScript?
const