Skip to content

When you pass a primitive value it is copied into the…

“When you pass a primitive value it is copied into the parameter. We call this “passing by value.” So if you change the value of the parameter in your function body it has no affect on our original argument’s value. The exception to this is passing an array or object, and we’ll get to that in a bit.” quote by Eric Freeman
Download Open image
““When you pass a primitive value it is copied into the parameter. We call this “passing by value.” So if you change the value of the parameter in your function body it has no affect on our original argument’s value. The exception to this is passing an array or object, and we’ll get to that in a bit.””

Eric Freeman

About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Passing primitive values copies them, so changes inside a function don't affect the original variable; objects and arrays are passed by reference.

In simple terms: Primitives are copied, objects are referenced.

Key Takeaway

Know when your data is mutable.

Themes

programming data handling functions

Mood

cautious analytical

Type

technical educational

When to use this quote

  • debugging
  • API design
  • performance tuning

Key Concepts

pass-by-value pass-by-reference mutability

Questions to Reflect On

  • Do you need a copy or a reference?
  • How can unintended mutations be avoided?
A Different Perspective

Changing an object inside a function can cause side effects elsewhere.

★ ★ ★ ★ ★ No ratings yet

More by Eric Freeman

Explore all 90 Eric Freeman quotes

More Technology quotes

Browse all 18,164 Technology quotes