There are many ways to empty an array in JavaScript some the important ways are as follows:-
The first way is to use A = [] and this is the most preferred way. You have another option which is A.length = 0 and lastly, you can use the splice method A.splice(0,A.length).
If you are passionate to pursue a career in Web Development, you can take up Web Development Online Courses by Intellipaat!