Javascript fundamentals

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/25

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

26 Terms

1
New cards

Primitive data types

Immutable values stored by value. Includes: string, number, boolean, null, undefined, symbol, bigint.

2
New cards

Reference data types

Stored by reference (memory address). Includes: objects, arrays, functions.

3
New cards

Difference between primitive and reference types

Primitives are copied by value, references are copied by memory reference.

4
New cards

var

Function-scoped, hoisted with undefined, can be redeclared and reassigned.

5
New cards

let

Block-scoped, hoisted but in Temporal Dead Zone, can be reassigned but not redeclared.

6
New cards

const

Block-scoped, must be initialized, cannot be reassigned.

7
New cards

Can const objects be mutated?

Yes, object properties can change, but the variable binding cannot.

8
New cards

Hoisting

JavaScript moves declarations of variables, functions, and classes to the top of their scope before execution.

9
New cards

Are variables hoisted?

Yes, but only declarations, not initializations.

10
New cards

Why block scope is important

Prevents accidental variable access and bugs.

11
New cards

Closure

A function that remembers variables from its outer scope even after the outer function has finished executing.

12
New cards
13
New cards

Common closure use cases

Data encapsulation, private variables, callbacks, event handlers.

14
New cards

Example of closure

function outer() {
let x = 10;
return function inner() {
return x;
}
}

15
New cards

this keyword

Refers to the object that is executing the current function

16
New cards

this in global scope

In browser: window; in strict mode: undefined.

17
New cards

call()

Invokes a function immediately with a specified this and arguments passed individually.

18
New cards

apply()

Invokes a function immediately with a specified this and arguments as an array.

19
New cards

bind()

Returns a new function with permanently bound this.

20
New cards

Difference between call and apply

call uses arguments list, apply uses arguments array.

21
New cards

When to use bind

When passing methods as callbacks and you want fixed this.

22
New cards

What is JavaScript?

A high-level, interpreted, dynamically typed programming language.

23
New cards

Is JavaScript single-threaded?

Yes, it runs on a single call stack.

24
New cards

What is the event loop?

A mechanism that handles asynchronous operations by pushing callbacks from the task queue to the call stack.

25
New cards

JavaScript runtime

Environment that executes JS (Browser, Node.js).

26
New cards

Why JS is non-blocking

Because async tasks are handled via Web APIs and the event loop.