Why var value is being updated in a function that only updates the parameter? – Job Application test Question

Here, i have some doubts with this piece of code i found in a job application test i made a few hours ago.

function foo(x){
    x['key'] = "new value"
}

var a = {'key': "old value"}

foo(a)

console.log (a)
  • Why is the a.key being updated when im just asigning a new value to
    the function parameter not to the global var?

Fiddle JS:
https://jsfiddle.net/SoujiCode/gu2xcwe6