empty array js
arr = []; // set array=[]
//function
const empty = arr => arr.length = 0;
//example
var arr= [1,2,3,4,5];
empty(arr) // arr=[]var colors = ["red","blue","green"];
colors = []; //empty the array// define Array
let list = [1, 2, 3, 4];
function empty() {
//empty your array
list = [];
}
empty();
let list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
var list = [1, 2, 3, 4];
function empty() {
//empty your array
list.length = 0;
}
empty();
if (array === undefined || array.length == 0) {
// array empty or does not exist
}
Also in JavaScript:
- how to run a vue js hello world app in vue version 3
- how to count occurences in an array with javascript
- check if string only contains integer digits numbers javascript
- javascript dom methods list
- javascript moment get current date
- how to do radio button validation in jquery
- firebase cheat sheet
- the best way of solve logarithm in js
- how to prevent previous radio button active react native
- how to check if a string has only alphabets in javascript
- npm install save shortcut
- js object clear
- number to string javascript
- get value in maps loop using enzym
- javascript object entries
- javascript determine if string is valid url
- cache buster in angular application
- pull out only text from element javascript
- react native multiple touchableopacity
- get platform node
- click outside box jquery
- jQuery exclude exteranl link for images
- javascript check if two date are ugual
- angular tilt