let variable1="hello";
function func1(variable){
variable="hello hello";
}
func1(variable1);
console.log("after function: "+variable1);
let object1={
property1:"hello2"
}
function func2(obj){
obj.property="hello object";
}
func2(object1);
console.log("after function:" +object1.property);
I have this code, the first console.log() returns
hello
but second console.log() returns
hello object
So I understood javascript cannot change and update variable but it can change and update property of object. But why and how?