101 Flashcards

(69 cards)

1
Q

What is JavaScript?

A

JavaScript is a high-level, dynamic, untyped, and interpreted programming language used primarily for web development.

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

What does the ‘var’ keyword do in JavaScript?

A

The ‘var’ keyword declares a variable that is function-scoped or globally-scoped.

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

Fill in the blank: In JavaScript, a _______ is a collection of key-value pairs.

A

Object

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

What is the purpose of the ‘console.log()’ function?

A

The ‘console.log()’ function outputs messages to the web console, useful for debugging.

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

What is an array in JavaScript?

A

An array is a data structure that can hold multiple values in a single variable.

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

Which symbol is used to denote a single-line comment in JavaScript?

A

//

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

What is the result of 5 + ‘5’ in JavaScript?

A

‘55’

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

True or False: JavaScript is case-sensitive.

A

True

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

What does DOM stand for?

A

Document Object Model

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

What are JavaScript functions?

A

Functions are reusable blocks of code that perform a specific task.

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

What keyword is used to define a constant in JavaScript?

A

const

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

What is the difference between ‘==’ and ‘===’ in JavaScript?

A

’==’ checks for value equality with type coercion, while ‘===’ checks for both value and type equality.

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

Fill in the blank: JavaScript uses _______ to handle asynchronous operations.

A

Promises

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

What is a closure in JavaScript?

A

A closure is a function that retains access to its lexical scope, even when the function is executed outside that scope.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
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
17
Q

What does the ‘this’ keyword refer to in JavaScript?

A

‘this’ refers to the context in which a function is executed.

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

What is the purpose of the ‘try…catch’ statement?

A

The ‘try…catch’ statement is used to handle exceptions and errors gracefully.

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

What is a promise in JavaScript?

A

A promise is 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
20
Q

True or False: JavaScript supports object-oriented programming.

A

True

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

What is event bubbling in JavaScript?

A

Event bubbling is a type of event propagation where the event moves from the target element up to the root of the DOM.

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

What does the ‘map()’ method do in JavaScript?

A

The ‘map()’ method 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
23
Q

Fill in the blank: The _______ keyword is used to create a new object in JavaScript.

A

new

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

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

A

‘let’ is block-scoped, while ‘var’ is function-scoped.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is a callback function?
A callback function is a function passed into another function as an argument to be executed later.
26
What is the purpose of the 'filter()' method?
The 'filter()' method creates a new array with all elements that pass the test implemented by the provided function.
27
True or False: JavaScript has a built-in type for dates.
True
28
What is the 'typeof' operator used for?
The 'typeof' operator is used to determine the data type of a variable.
29
What does the 'reduce()' method do?
The 'reduce()' method executes a reducer function on each element of the array, resulting in a single output value.
30
What is the purpose of the 'setTimeout()' function?
The 'setTimeout()' function calls a function or evaluates an expression after a specified number of milliseconds.
31
Fill in the blank: JavaScript uses _______ to manage asynchronous code execution.
Event loop
32
What is a module in JavaScript?
A module is a self-contained piece of code that can be reused and imported/exported in different parts of an application.
33
What are template literals in JavaScript?
Template literals are string literals that allow embedded expressions, enclosed by backticks (`).
34
True or False: JavaScript can manipulate the HTML and CSS of a web page.
True
35
What is the 'window' object?
The 'window' object represents the browser window and is the global object in a web environment.
36
What does 'NaN' stand for in JavaScript?
NaN stands for 'Not-a-Number'.
37
What is the purpose of the 'splice()' method?
The 'splice()' method changes the contents of an array by removing or replacing existing elements and/or adding new elements.
38
What is an IIFE?
An IIFE is an Immediately Invoked Function Expression that runs as soon as it is defined.
39
What does 'JSON.stringify()' do?
The 'JSON.stringify()' method converts a JavaScript object or value to a JSON string.
40
Fill in the blank: JavaScript uses _______ to handle errors.
Exceptions
41
What is the purpose of the 'async' keyword?
The 'async' keyword is used to declare an asynchronous function that returns a promise.
42
What is the purpose of the 'await' keyword?
The 'await' keyword is used to pause the execution of an async function until a promise is resolved.
43
True or False: JavaScript supports inheritance.
True
44
What is the 'Array.isArray()' method used for?
The 'Array.isArray()' method determines whether the passed value is an Array.
45
What does the 'Math.random()' function do?
The 'Math.random()' function returns a floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive).
46
What is the purpose of the 'forEach()' method?
The 'forEach()' method executes a provided function once for each array element.
47
What is a 'Promise.all()' method used for?
'Promise.all()' returns a single Promise that resolves when all of the promises in the iterable have resolved.
48
What does the 'slice()' method do?
The 'slice()' method returns a shallow copy of a portion of an array into a new array object.
49
What is the purpose of the 'Object.keys()' method?
The 'Object.keys()' method returns an array of a given object's own property names.
50
What is the 'localStorage' object?
'localStorage' is a Web Storage API that allows you to store data in the browser persistently.
51
Fill in the blank: The _______ method removes the last element from an array.
pop
52
What is the difference between 'undefined' and 'null'?
'undefined' means a variable has been declared but not assigned a value, while 'null' is an assignment value that represents no value.
53
What is the 'fetch()' API used for?
The 'fetch()' API is used to make network requests and handle responses in a promise-based manner.
54
What does the 'spread' operator do?
The spread operator allows an iterable (like an array) to be expanded in places where zero or more arguments or elements are expected.
55
What is the difference between a 'function declaration' and a 'function expression'?
A function declaration defines a named function that can be called before it's defined, while a function expression creates a function that can only be called after it's defined.
56
What does 'Math.floor()' do?
The 'Math.floor()' function returns the largest integer less than or equal to a given number.
57
What is the 'setInterval()' function used for?
The 'setInterval()' function repeatedly calls a function with a fixed time delay between each call.
58
True or False: JavaScript can be used on the server-side.
True
59
What is the purpose of the 'bind()' method?
The 'bind()' method creates a new function that, when called, has its 'this' keyword set to the provided value.
60
What is the 'slice()' method?
The 'slice()' method returns a shallow copy of a portion of an array into a new array object.
61
What is a 'symbol' in JavaScript?
A symbol is a unique and immutable primitive value that can be used as the key of an object property.
62
What is the 'reduceRight()' method?
The 'reduceRight()' method executes a reducer function on each element of the array, from right to left.
63
What does 'Object.assign()' do?
'Object.assign()' copies all enumerable own properties from one or more source objects to a target object.
64
What is a 'getter' in JavaScript?
A getter is a special method that gets the value of a specific property in an object.
65
What is a 'setter' in JavaScript?
A setter is a special method that sets the value of a specific property in an object.
66
What does 'Object.freeze()' do?
'Object.freeze()' prevents new properties from being added to an object and marks all existing properties as read-only.
67
What is a 'prototype' in JavaScript?
A prototype is an object from which other objects inherit properties.
68
What is the 'instanceof' operator used for?
The 'instanceof' operator tests whether an object is an instance of a specific constructor.
69
What is the 'length' property of an array?
The 'length' property of an array returns the number of elements in that array.