Answered by : reagan-mcfarland
if (array === undefined || array.length == 0) { // array empty or does not exist
}
Source : | Last Update : Sat, 12 Sep 20
Answered by : vikas
arr = []; // set array=[]
//function
const empty = arr => arr.length = 0;
//example
var arr= [1,2,3,4,5];
empty(arr) // arr=[]
Source : https://1loc.dev/#compare-two-arrays-regardless-of-order | Last Update : Thu, 09 Jul 20
Answered by : marton
const myArray1 = []
// or...
const myArray2 = new Array()
Source : | Last Update : Wed, 02 Sep 20
Answered by : code-grepper
var colors = ["red","blue","green"]; colors = []; //empty the array
Source : | Last Update : Tue, 29 Oct 19
Answered by : ilham-surya
arr = [];
Source : https://www.tutorialspoint.com/in-javascript-how-to-empty-an-array | Last Update : Sat, 05 Mar 22
Answered by : philani-sithembiso-ndhlela
let list = [1, 2, 3, 4];
function empty() { //empty your array list.length = 0;
}
empty();
Source : https://www.jstips.co/en/javascript/two-ways-to-empty-an-array/ | Last Update : Mon, 08 Jun 20
Answered by : mike-keller
let arrayName = [];
Source : | Last Update : Tue, 24 Mar 20
Answered by : distinct-dotterel-lhrq2rbi87v3
A = [];
Source : https://stackoverflow.com/questions/1232040/how-do-i-empty-an-array-in-javascript | Last Update : Fri, 30 Oct 20
Answered by : philani-sithembiso-ndhlela
// define Array
let list = [1, 2, 3, 4];
function empty() { //empty your array list = [];
}
empty();
Source : https://www.jstips.co/en/javascript/two-ways-to-empty-an-array/ | Last Update : Mon, 08 Jun 20
Answered by : jessica-koekemoer
// Variable array for a wider scope:
var arrayName = [];
// Local scope variable array:
let arrayName = [];
Source : | Last Update : Wed, 17 Jun 20