Knowledge Walls
John Peter
Pune, Maharashtra, India
How to use call by reference in Javascript functions with Example
2895 Views
HTML
<p><b>How to use call by reference in Javascript functions with Example</b></p>
JAVASCRIPT
function addAdditionalNames(userNames){
    userNames.push("Sarathy");
    userNames.push("Gopal");
    userNames.push("Lakshanya");
}

var userNames = new Array();

userNames.push("Raja");
userNames.push("Vijay");
userNames.push("Kumar");

document.write(userNames+"<br />");

addAdditionalNames(userNames);

document.write(userNames+"<br />");
Demo & Output 
Previous Topics
Previous lessons of current book.
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details