Skip to content

Instantly share code, notes, and snippets.

@zahra-ove
Created March 16, 2022 08:20
Show Gist options
  • Save zahra-ove/53e16d8d700ec48e9330c66f56eb3e0a to your computer and use it in GitHub Desktop.
Save zahra-ove/53e16d8d700ec48e9330c66f56eb3e0a to your computer and use it in GitHub Desktop.
All javascript notes:
1. this article is awesome. it is about two types of variables in javascript:
- primitive variables
- reference variables
link: https://www.javascripttutorial.net/javascript-primitive-vs-reference-values/
Summary
Javascript has two types of values: primitive values and reference values.
You can add, change, or delete properties to a reference value, whereas you cannot do it with a primitive value.
Copying a primitive value from one variable to another creates a separate value copy. It means that changing the value in one variable does not affect the other.
Copying a reference from one variable to another creates a reference so that two variables refer to the same object. This means that changing the object via one variable reflects in another variable.
======================================================================================================
2. which one is primitive and which is reference:
Primitive Values
number
string
boolean
undefined
null
symbol
Reference Values
anything that is "typeof" "object"
objects
arrays
functions
======================================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment