当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Opencv finding the intersection of two regions
Virtual machine network connection mode
Ros2 self study notes: rqt visualization tool
数组和特殊矩阵的压缩存储
Description and usage of Axi interconnect IP core
Wechat applet class binding, how to bind two variables
虚拟机网络连接方式
新零售电商平台怎么做?才能实现传统零售企业数字化转型?
【redis入门系列】redis搭建主从服务器
Pymoo学习 (4): 多标准决策
JMeter之函数二次开发/插件开发(细版)
OpenIM重大优化-消息按需加载 一致性缓存 uniapp发布
食品安全|听起来很健康的植物肉,是什么来头?
Pymoo学习 (2):带约束的双目标优化问题
MySQL 啥时候用表锁,啥时候用行锁?
简单了解首个 EVM 等效的 zkEVM Polygon 为何全力押注
Dead beat recursion 1: recursive formula
VScode——代码、文件改动无法保存
Could not load dynamic library ‘cudnn64_8.dll‘; dlerror: cudnn64_8.dll not found
benthos杂记









