Now suppose that you want to delete all elements from an array. There are two easy ways to do so. The first one is just creating this array again, using foods are the equals to square buckets, empty square brackets, and semicolon. So now if I use the console, and log on I pass foods now to this console log, I am going to get an empty array. So this is the first easy way to delete all elements from an array. The second way, the second easy way to delete all elements is using the length method.
The first of all, I'm going to use the length method here on length. And I'm going to print all the number of all elements. here if I comment this out, and Save and Run, I'm going to get three and what three means is that this array as Elements 123. So the link now is three. But if I want to delete all elements mistakenly, by using the link, I would foods have been called the link. And I'm going to change that link to be zero.
Right. Now if I save and run and pass foods to the console work, I am going to get nothing an empty array because they changed the length to be zero. So we have two easy ways to delete all elements from an array either by creating the foods and then empty square brackets or by using billing and making the length of this array to be zero.