A JavaScript code:
var age = 27;
var obj = {
name: 'Jona',
city: 'Lisbon'
};
function change(a, b) {
a = 30;
b.city = 'San Francisco';
}
change(age, obj);
console.log('age:', age);
console.log('obj.city:', obj.city);
The result in console is 27, San Francisco respectively. I am confused with that why the value of age is 27 instead of 30. In my opinion, the value of variable age will be changed to 30 after calling function change. Can someone answer it?