empty array javascript

JavaScript
// define Array
let list = [1, 2, 3, 4];
function empty() {
    //empty your array
    list = [];
}
empty();
const colors = ["red","blue","green"];
colors.lenght = 0;A.length = 0A = [];let list = [1, 2, 3, 4];
function empty() {
    //empty your array
    list.length = 0;
}
empty();
var colors = ["red","blue","green"];
    colors = []; //empty the array
Source

Also in JavaScript: