JavaScript Study Guide Core Concepts

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/54

flashcard set

Earn XP

Description and Tags

These flashcards cover the core concepts of JavaScript, including console methods, variables, data types, operators, functions, objects, and more.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

55 Terms

1
New cards

What is the primary purpose of the Console Object in JavaScript?

The Console Object is primarily used as a debugging tool that shows runtime execution and logs information.

2
New cards

What does console.log() do?

Outputs values to the console.

3
New cards

What is the difference between 'var', 'let', and 'const'?

'var' is function-scoped and hoisted, 'let' is block-scoped and can be reassigned but not redeclared, and 'const' is block-scoped and cannot be reassigned.

4
New cards

What is scope in JavaScript?

Scope refers to the accessibility of variables within different parts of code.

5
New cards

What is hoisting?

Hoisting is a JavaScript mechanism where variable declarations are processed before the code executes.

6
New cards

Name the primitive data types in JavaScript.

String, Number, Boolean, undefined, null, Symbol, BigInt.

7
New cards

What are the two types of operators in JavaScript?

Arithmetic and assignment operators.

8
New cards

What is type coercion?

Type coercion is the automatic or explicit conversion of values from one data type to another.

9
New cards

What are 'falsy' values in JavaScript?

Falsy values include false, 0, '', null, undefined, and NaN.

10
New cards

What are the advantages of using 'let' over 'var'?

'let' is block-scoped, preventing issues related to hoisting and variable redeclarations.

11
New cards

How do you create an object in JavaScript?

Objects can be created using object literals or constructors.

12
New cards

What is the purpose of the 'this' keyword in an object method?

'This' refers to the object that the method is called upon.

13
New cards

Define a higher-order function.

A higher-order function is a function that takes another function as an argument or returns a function as a result.

14
New cards

What is destructuring in JavaScript?

Destructuring allows you to extract values from arrays or properties from objects into distinct variables.

15
New cards

What does the spread operator do?

The spread operator expands an iterable (like an array) into more elements.

16
New cards

What is the difference between '==' and '==='?

'==' compares values with type coercion, while '===' compares both values and types without coercion.

17
New cards

What are asynchronous functions in JavaScript?

Asynchronous functions allow you to write code that performs tasks without blocking the execution of other code.

18
New cards

What is a promise in JavaScript?

A promise is an object that represents the eventual completion or failure of an asynchronous operation.

19
New cards

What is the purpose of the JSON object in JavaScript?

The JSON object is used to convert JavaScript objects to JSON strings and JSON strings back to JavaScript objects.

20
New cards

What does the fetch API do?

The fetch API allows you to make HTTP requests to servers and handle responses.

21
New cards

What is a callback function?

A callback function is a function passed into another function as an argument to be executed later.

22
New cards

Define event bubbling in JavaScript.

Event bubbling is a way of event propagation in the DOM where an event starts from the target element and bubbles up to its ancestors.

23
New cards

What is method chaining?

Method chaining allows multiple method calls on the same object in a single statement.

24
New cards

Explain what a pure function is.

A pure function is a function that always returns the same output for the same input and has no side effects.

25
New cards

What is hoisting in JavaScript?

Hoisting refers to the behavior of moving function and variable declarations to the top of their containing scope during the compile phase.

26
New cards

What is a constructor function in JavaScript?

A constructor function is a function used to create new objects and is defined with the 'new' keyword.

27
New cards

How can you access an array item in JavaScript?

You can access an array item by its index, using square brackets (e.g., array[index]).

28
New cards

What does 'Array.from()' do?

Array.from() creates a new Array instance from an array-like or iterable object.

29
New cards

What is a 'class' in JavaScript?

A class is a blueprint for creating objects, containing methods and properties.

30
New cards

What is inheritance in JavaScript?

Inheritance allows one class to inherit properties and methods from another class.

31
New cards

Explain the concept of 'modules' in JavaScript.

Modules are used to organize code, allowing encapsulation and reuse through export and import statements.

32
New cards

What is the difference between named and default exports?

Named exports allow you to export multiple values, while a default export allows only one value to be exported from a module.

33
New cards

What are 'getters' and 'setters' in JavaScript classes?

Getters and setters are special methods to define how properties should be accessed and mutated in an object.

34
New cards

What does the 'super' keyword do?

The 'super' keyword is used to call functions on an object's parent class.

35
New cards

Define an asynchronous function with async/await.

An async function is declared with 'async' and allows the use of 'await' to pause execution until a promise is resolved.

36
New cards

What is the purpose of the 'await' keyword?

'Await' is used to wait for a promise to resolve before continuing execution of the async function.

37
New cards

How do you handle errors in async functions?

Errors in async functions can be handled using try/catch blocks.

38
New cards

What is the purpose of console.warn()?

Outputs a warning message to the console.

39
New cards

How would you log an error message to the console in JavaScript?

Use console.error() to log an error message.

40
New cards

What is the method to display tabular data in the console?

console.table() is used to display tabular data.

41
New cards

How do you modify the text content of an HTML element using the DOM?

You can modify the text content using the textContent property.

42
New cards

What is the difference between .innerHTML and .textContent?

.innerHTML can read and update HTML content, while .textContent only deals with plain text.

43
New cards

What is the event object in an event listener?

The event object contains information about the event that occurred, such as properties and methods related to the event.

44
New cards

What does 'array.map()' do?

The array.map() method creates a new array populated with the results of calling a provided function on every element in the calling array.

45
New cards

What is the difference between .push() and .unshift() in arrays?

.push() adds an element to the end of an array, while .unshift() adds an element to the beginning.

46
New cards

What does .filter() do in an array?

.filter() creates a new array with all elements that pass the test implemented by the provided function.

47
New cards

What is the purpose of the .reduce() method?

.reduce() executes a reducer function on each element of the array, resulting in a single output value.

48
New cards

How can events be delegated in JavaScript?

Events can be delegated by adding a single event listener to a parent element that monitors events for its child elements.

49
New cards

What does 'parseInt()' do in JavaScript?

parseInt() converts a string to an integer.

50
New cards

What is the role of the 'return' statement in functions?

The return statement specifies the value to be returned from a function.

51
New cards

How can you convert a value to a number?

You can convert to a number using Number(), parseInt(), or parseFloat().

52
New cards

What is a callback hell?

Callback hell is a situation in JavaScript where callbacks are nested within other callbacks, leading to complex and hard-to-read code.

53
New cards

What does console.time() do?

console.time() starts a timer that can be used to measure the duration of a task.

54
New cards

What does console.timeEnd() do?

console.timeEnd() stops the timer that was started by console.time() and logs the elapsed time.

55
New cards

Explain what 'null' and 'undefined' represent in JavaScript.

'null' represents an intentional absence of any value, while 'undefined' indicates that a variable has been declared but not assigned a value.