Is it possible to change the variable value with function like example below? Whenever I change the passed parameter value the original value doesn't change. Why is this happening?
let b = 3;
function t(n) {
n = 5;
}
t(b)
console.log(b) // still 3
I know this can be done like this, but I am wondering why the example above wont work.
let b = 3;
function t() {
return 5;
}
b = t();
console.log(b)