Sign in
Log inSign up

Arguments passing in JavaScript

Default profile photo
Anonymous
·Mar 12, 2018
function SetName(obj){
  obj.name="Stevce";
  obj = new Object();
  obj.name="greg";
}
var person = new Object();
SetName(person);

alert(person.name);

Here my question is whether the person is passed to the function as a reference or value ,In some book it has been written that all the function argument in EcmaScript are passed by values .

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct