标签: javascript angular typescript reference primitive
我搜索了互联网但没有找到任何内容。
这是我想要的例子:
test() { var a = 1; var b = a; b = 2; console.log(a); //I want the output is 2 and not 1 }
我知道对象和数组是通过引用传递的,并且可以解决问题,但我无法使用该方法。
我希望能很好地解释我的问题。