Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 812365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:11:33+00:00 2026-05-15T01:11:33+00:00

When i started learning function in C++ its all around pass by value and

  • 0

When i started learning function in C++ its all around pass by value and reference.
Is there something similar we have in javascript ?

If yes/not how it works in case of javascript?

Thanks all.

  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:11:34+00:00Added an answer on May 15, 2026 at 1:11 am

    JavaScript is always pass by value, never pass by reference. A lot of people confuse this because of the way objects work.

    There is no “pass by reference” for any variable in JavaScript (no, not even if an object is assigned to that variable). All variables and arguments are assigned by value. If the assigned value is an object, then the value of the new variable is a reference to that object, but assigning a new value/object to the new variable will not affect the original variable.

    Some people term this behaviour passing “value by reference”.

    A comparison – PHP

    $foo = "foo";
    $bar = &$foo;  // assign by reference
    $bar = "bar";
    echo $foo; // -> output: "bar"
    

    JavaScript

    foo = {"foo": true};
    bar = foo;     // assign value by reference
    bar = {"bar": true};
    alert(JSON.stringify(foo)); // -> output: '{"foo": true}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have started to learning Jquery and i can't activate the resizable function. i
I have just started learning C. void function(char *str1, char *str2) { printf(%p\n, str1);
Warning: I just started learning bash recently and trying to do a recursive function
I started learning JavaScript a while ago. It's a fairly easy programming language considering
I have just started learning python version 3 and trying to create a file
I have only started learning python recently. I would still be considered a beginner.
I started learning LISP and I heard that there is some kind of a
I have just started learning pthreads API and I am following the tutorial here
I've just started learning jQuery/javascript, so this might seem like a really basic question,
I'm a real noob who just started learning 3d programming and i have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.