Skip to content

Instantly share code, notes, and snippets.

View Harry-Kwesi's full-sized avatar

Kwesi Harry-Kwesi

View GitHub Profile
@Harry-Kwesi
Harry-Kwesi / primitive-reference-types-javascript.md
Created March 13, 2023 17:51 — forked from branneman/primitive-reference-types-javascript.md
Primitive Types & Reference Types in JavaScript

Primitive Types & Reference Types in JavaScript

An explanation of JavaScript's pass-by-value, which is unlike pass-by-reference from other languages.

Facts

  • JavaScript has 2 kinds of variable types: primitive and reference.
  • A fixed amount of memory is reserved after creation of every variable.
  • When a variable is copied, it's in-memory value is copied.
  • Passing a variable to a function via a call also creates a copy of that variable.

Primitive Types

@Harry-Kwesi
Harry-Kwesi / event-loop.md
Created March 12, 2023 04:51 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code