当前位置:网站首页>Typescript empty array
Typescript empty array
2022-07-23 17:25:00 【Liang Yunliang】
Mode one : Set the length attribute of the array to 0
let array = ["aa","bb","cc","dd"]
console.log(array)
array.length=0
console.log(array)
Mode two : call splice remove
splice(): Add or remove elements from an array .
let array = ["aa","bb","cc","dd"]
console.log(array)
array.splice(0,array.length)
console.log(array)
Mode three : Let the variable point to a new array
let array = ["aa","bb","cc","dd"]
console.log(array)
array = []
console.log(array)
Be careful : This method may lead to memory leakage
边栏推荐
- Preliminary understanding of string
- 【mysql集群故障恢复】
- Opencv finding the intersection of two regions
- How many common SQL misuses are there in MySQL?
- 食品安全|吃皮蛋会铅中毒?了解这几点后放心吃
- PMP practice once a day | don't get lost in the exam -7.23
- Pymoo learning (4): multi criteria decision making
- Shell | 查看进程的方法的不完全总结
- 软件配置 | Anaconda下载、安装及环境配置和卸载
- 常见模拟电路设计 一(含仿真):方波、三角波、正弦波的互相发生「建议收藏」
猜你喜欢

keil错误和解决办法(1):FCARM - Output Name not specified, please check ‘Options for Target - Utilities‘

场景小小记

详解一次SQL优化

Dead beat recursion 1: recursive formula

食品安全|听起来很健康的植物肉,是什么来头?

日志瘦身骚操作:从5G优化到1G!

Tips and tricks for neural networks deep learning and training skills summary (updated from time to time)
[web vulnerability exploration] SQL injection vulnerability

OpenCV求两个区域的交集

Pymoo学习 (4): 多标准决策
随机推荐
oracle 数据库 11C 之后版本使用 memory_target 自动内存管理
Software configuration | pychart download, installation, environment configuration and uninstall
数组和特殊矩阵的压缩存储
quota命令详细拓展使用方法,RHEL 7中quota命令搭载方法!磁盘容量配额!
食品安全|吃皮蛋会铅中毒?了解这几点后放心吃
蓝桥杯真题:卡片[通俗易懂]
wsus可以打mysql中间件补丁_加入WSUS补丁服务器并下载补丁
Fundamentals of C language -- the data type meaning of 2-4 pointers and the analysis of forced type conversion
First deep search and first wide search of graph (realized by three methods)
Pymoo learning (3): use multi-objective optimization to find the set of optimal solutions
动态库*.dll文件的Debug/Release版本是否可以混用(交叉用)?
What about the new retail e-commerce platform? Can we realize the digital transformation of traditional retail enterprises?
Virtual machine network connection mode
Wechat applet class binding, how to bind two variables
在 Kotlin 中使用 Flow Builder 创建流
Pymoo学习 (3):使用多目标优化找到最优解的集合
食品安全|爱吃烟熏食品的注意了,这些知识你知道吗
Explain SQL optimization in detail
Could not load dynamic library ‘cudnn64_8.dll‘; dlerror: cudnn64_8.dll not found
PPPoE协议讲解以及拨号过程Wireshark抓包解析