ECMAScript variables may contains two different types of data: primitive values and reference values. Primitive values are simple atomic pieces of data, while reference values are objects that may be made up of multiple values.

  The five primitive types are: Undefined, Null, Boolean, Number and String.

  primitive values are accessed by value, while reference values are accessed by reference.

Copying Values

  Primitive and reference values act differently when copied from one variable to another.

  When a primitive value is assigned from one variable to another, the value stored on the variable object is created and copied into the location for the new variable.

  When a reference value is assigned from one variable to another, the value stored on the variable object is also copied into the location for the new variable. The different is that this value is actually a pointer to an object stored on the heap. Once the operation is complete, two variables point to exactly the same object, so changes to one are reflected on the other.

Argument Passing

  When an argument is passed by value, the value is copied into a local variable(a named argument and, in ECMAScript, a slot in the arguments object). When an argument is passed by reference, the location of a value in memory is stored into a local variable, which means that changes to the local variable are reflected outside of the function .

最新文章

  1. C# RSA加密解密
  2. CSS white-space 属性
  3. AC日记——最长最短单词 openjudge 1.7 25
  4. 【转】关于Class.getResource和ClassLoader.getResource的路径问题
  5. 解谜谷歌 DevOps:什么特质可以打造世界级可靠系统?
  6. r语言入门资料
  7. 实现一个div在浏览器水平居中
  8. Action<>和Func<>区别
  9. MAVEN 工程打包resources目录外的更多资源文件
  10. linux操作系下RAR的使用
  11. 利刃 MVVMLight 4:绑定和绑定的各种使用场景
  12. C++雾中风景1:友元类与面向对象
  13. Surface pro 4 使用心得
  14. UPC:ABS
  15. 跨域学习笔记1--跨域调用webapi
  16. ubuntu 手动更新源 以及使用sudo update与upgrade的作用及区别
  17. ORA-01440 要减小精度或者标度.则要修改的列必须为空.
  18. Go 初体验 - 令人惊叹的语法 - defer.1 - 基本概念和用法
  19. svn 回退/更新/取消至某个版本命令详解【转】
  20. js 树结构数据遍历条件判断

热门文章

  1. Lucky HDU - 5213 (莫队,容斥)
  2. 高性能mysql 第10章 复制
  3. 【VUE】Vue 源码解析
  4. SP Flash Tool版本对应MTK处理器型号速查(SP Flash Tool Download)
  5. 说一说你对HTML5语义化的理解
  6. 2017 阿里巴巴 C++后台开发一面 3.14
  7. Nginx解析PHP
  8. 【Winfrom-适配窗体】 WinForm窗体及其控件的自适应,控件随着窗体变化
  9. AOP 实现日志
  10. redis string类型设置过期时间后 再进行set操作,会清除过期时间