当前位置:网站首页>立即执行函数 分号问题
立即执行函数 分号问题
2022-07-22 04:28:00 【tutou_girl】
养成一个好习惯
匿名函数前后加分号
const temp=[2,4,6,8]
;(function(arr){
for(let i=0;i<arr.length;i++){
let random=Math.ceil(Math.random()*(arr.length-1-i)+i)
swap(arr,i,random)
}
console.log(arr)
}([2,4,6,8]));
// const temp=[2,4,6,8]
function swap(arr,a,b){
let temp=arr[a]
arr[a]=arr[b]
arr[b]=temp
}
前面不加分号会报错[2,4,6,8] is not a function
边栏推荐
- 数据平台数据管理实践
- 交换机与路由器技术:OSPF路由重分发、OSPF的NSSA区域和OSPF虚链路
- [leetcode string -- string subscript sorting] 6121. Query the number with the smallest k after cutting the number
- AT4379 [AGC027E] ABBreviate
- AT2336 [ARC069D] Flags
- MP query criteria
- BUUCTFReservewp(3)
- Hybrid hybrid development and jsbridge
- Thinking about the transformation between string and char[]
- Lecture 7 pipeline, environment variables and common commands
猜你喜欢
ECCV 2022 | 修正FPN帶來的大目標性能損害:You Should Look at All Objects
mysql通过开启全局日志进行定位排查慢sql
Transparent transmission of punctual atom Lora wireless serial port point-to-point communication and Its Precautions
What is SCM? What are the components of SCM?
服务器与本地资料互传的命令行代码
二叉树OJ题,IO题
On contract testing
toString()及重写的作用与应用
交换机与路由器技术:标准ACL、扩展ACL和命名ACL
Screen command use
随机推荐
[ssm]ssm integration ① (integration configuration)
PXE network installation
C语言程序练习——(写一个函数,它的原形是int continumax(char *outputstr,char *intputstr))
Fastjson 代码执行 CVE-2022-25845
Android interview: 2022 please keep this experience of Netease Android development and Tiktok e-commerce Android engineers
Screen command use
[SSM]SSM整合②(功能模块的开发)
交换机与路由器技术:OSPF路由重分发、OSPF的NSSA区域和OSPF虚链路
NFT exchange contract development tutorial (solidity & hardhat)
用c语言编写一个函数用来删除字符串中的空格并返回空格个数
MySQL查询计划key_len如何计算
[ARC116F] Deque Game
Kalman filter program of POTU PLC signal processing series
JVM memory model: classification and acquisition of class loaders
交換機與路由器技術:標准ACL、擴展ACL和命名ACL
Mysql database column splicing query writing method
Technologie des commutateurs et des routeurs: ACL standard, ACL étendu et ACL nommé
Interview questions of computer network transmission layer
JVM memory model: virtual machine stack
Repair the problem of adding device groups and editing exceptions on easycvr platform