Primitive types and properties that are primitive types are pass by value, objects and functions are pass by reference.
let a = function bar() { };
function foo( a ) {
a = 2;
}
foo( a );
console.log( a ); // bar