This answer quotes ChatGPT
In this code, the first console.log outputs "abc" because data was assigned "abc" before fun was called. Then, the fun function is called, taking data, which is "abc". Inside the fun function, concatenate data with the string "xyz" to produce a new string "abcxyz". However, this does not change the original data variable, because strings are immutable in JavaScript. So, when fun finishes, data is still "abc". So, when the second console.log is called, the output value is still "abc".