当前位置:网站首页>引用类型 ,值类型 ,小坑。
引用类型 ,值类型 ,小坑。
2022-08-02 20:04:00 【Ares-Wang】


/*
js 函数调用时传递变量参数时,依据传递实参是值类型还是引用类型
来判断的,传的实参是值类型 就是值类型,传的实参是引用类型,就是引用类型
*/
var v=100
function fn(v){
v=1
}
fn(v) //100
var obj={
name:'Ares'}
function fn(obj){
obj.name='Ares_Wang'
}
fn(obj) //Ares_Wang
var obj={
name:'Ares'}
function fn(obj){
obj={
name:'Ares_Wang'}
}
fn(obj)// Ares

typeof: 返回是数据类型的字符串
数值 ‘number’
字符串 ‘string’
布尔型 ‘boolean’
undefined ‘undefined’
function ‘fucntion’
instanceof 判断对象的具体类型
=== null/undefined
边栏推荐
- Common tools and test methods for interface testing (Introduction)
- 第七章 噪声
- EasyExcel dynamic parsing and save table columns
- 信息学奥赛一本通(1258:【例9.2】数字金字塔)
- TPAMI2022 | TransCL: based on the study the compression of the Transformer, more flexible and more powerful
- TodoList案例
- 二丙二醇甲醚醋酸酯
- setup syntax sugar defineProps defineEmits defineExpose
- LeetCode:622. 设计循环队列【模拟循环队列】
- 遇上Mysql亿级优化,怎么办
猜你喜欢
The time series database has been developed for 5 years. What problem does it need to solve?

信息学奥赛一本通(1259:【例9.3】求最长不下降序列)

In action: 10 ways to implement delayed tasks, with code!

Redis集群配置

【手撕AHB-APB Bridge】~ AMBA总线 之 APB

OpenCV开发中的内存管理问题

AI Scientist: Automatically discover hidden state variables of physical systems

J9 digital theory: the Internet across chain bridge has what effect?

信息学奥赛一本通(1258:【例9.2】数字金字塔)

成为黑客不得不学的语言,看完觉得你们还可吗?
随机推荐
什么是 IDE
【手撕AHB-APB Bridge】~ AMBA总线 之 APB
SQL Server安装教程
六石管理学:入门机会只有一次,先把产品做好
五大维度解读软件测试分类
李沐动手学深度学习V2-bert预训练数据集和代码实现
J9 digital theory: the Internet across chain bridge has what effect?
Axure9的元件用法
【软件工程导论】软件工程导论笔记
【StoneDB性能相关工具】内存监控
模板的进阶
牛客题目——滑动窗口的最大值、矩阵最长递增路径、顺时针旋转矩阵、接雨水问题
ABAP语法小复习
第一次进入前20名
对话亚洲高校首个博士论文奖-裘捷中丨KDD2022
Geoserver+mysql+openlayers2
C# Barrier类
基本语法(三)
Async的线程池使用的哪个?
基于“无依赖绝对定位”实现的圣杯三栏布局