<script> function foo(a,b) { console.log("Enter into foo and param1 = ", a, " param2 = ", b); a = 99; b.value = 100; console.log("Enter into foo and param1 = ", a, " param2 = ", b); return; } var one=0, two = {value: 0}; console.log("In the main one = ", one, " two = " , two.value); foo(one, two); console.log("Back in the main one = ", one, " two = " , two.value); </script>