js
// check the console for output
<script>
// Copying, passing, and comparing by value
let x = 50
let y = x
x = 40
console.log('Copying, passing, and comparing by value Output: ' + y)
// Copying, passing, and comparing by reference
x = {name: "pratham"}
y = x
x.name = "yash"
console.log('Copying, passing, and comparing by reference Output: ' + y.name)
// References themselves are passed by value
let count = 0
const increase_count = (count) => {
count++
}
increase_count(count)
console.log('References themselves are passed by value Output: ' + count)
</script>