Skip to content

Instantly share code, notes, and snippets.

View bishoyAtif's full-sized avatar

BishoyAtif bishoyAtif

View GitHub Profile
@bishoyAtif
bishoyAtif / primitive-reference-types-javascript.md
Last active March 5, 2019 16:08 — 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