The super quick answer to this question is that primitive types such as strings, numbers and boolean are passed by value but objects and arrays are passed by reference.
However do you really understand what passing by value or reference really means? If you don't you can get confused when you're not getting the value you expect in your code. This is also the kind of question that will often be asked in an interview so it's really important to have a good understanding of the two terms.
Pass by Value
Passing by value means that you don't affect variables that are outside of your scope. Lets take a look at a quick example.
Here we create a variable called myValue and set it to 1. We then create the passByValue function which takes the myValue function and set it to equal 2. Finally we call the passByValue function passing it myValue and log the value of myValue to the console. The variable myValue is still one because primitives are passed by value. You're essentially creating a copy of myValue which is passed to the function. So anything that is done to myValue within the function will not change the myValue that is outside the function because of it's scope and the fact its passed by value.
Pass by reference
Objects unlike primitive types are passed by reference. This means that a variable points to a reference of that object rather than a copy of that object. So if you were to change the value of that objects property this changes that object wherever it's referenced. Lets take a look at another example.
Here we have an empty object with the really original name myObject. The passByReference function takes a parameter in this case the myObject and sets the property num to equal 2. The passByReference function is then called and the myObject is printed to the console.
There is one final thing to look at with passing by reference so lets look at another example.
To sum up: primitives are passed by value. Objects and arrays (non-primitives) are passed by reference.