JavaScript で 配列を空にする
var arr = ['aaa', 'bbb', 'ccc'];console.log(arr); //=>['aaa', 'bbb', 'ccc']
arr.length = 0;
console.log(arr); //=>[]
</pre>
Written by kubio
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Related Tags
#javascript
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#