Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Sawamara
on Jan 25, 2018
|
parent
|
context
|
favorite
| on:
Deep-copying in JavaScript
Primitive types and properties that are primitive types are pass by value, objects and functions are pass by reference.
k2xl
on Jan 25, 2018
|
next
[–]
It's still pass by value. The value of the object happens to be a reference to a memory location. A primitive also points to a memory location too.
windwake12
on Jan 25, 2018
|
prev
[–]
There's no difference
let a = function bar() { }; function foo( a ) { a = 2; } foo( a ); console.log( a ); // bar
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: