The difference between value types and reference types
巴扎黑
Release: 2016-12-19 14:24:00
Original
1096 people have browsed it
<script type="text/javascript">
var i = 1;
var j = 2;
var a = [1, 2];
function arr(b) {
b[0] = 2;
}
function me(x, y) {
x = x+y;
return x;
}
arr(a);
console.log(i); // 1
console.log(JSON.stringify(a)); // [2,2]
</script>
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn