Nodejs Array Clear clear()

Here you can find the source of clear()

Method Source Code

/**//from   w w w . j  a v a 2 s.  com
 *  Array#clear() -> Array
 *
 *  Clears the array (makes it empty) and returns the array reference.
 *
 *  ##### Example
 *
 *      var guys = ['Sam', 'Justin', 'Andrew', 'Dan'];
 *      guys.clear();
 *      // -> []
 *      guys
 *      // -> []
**/
Array.prototype.clear = function() {
  this.length = 0;
  return this;
};

Related

  1. clear()
    Array.prototype.clear = function() {
      this.length = 0;
      return this;
    };
    
  2. clear()
    'use strict';
    Array.prototype.clear = function() {
        this.length = 0;
    
  3. clear()
    window.onload = function(){
      test();
    Array.prototype.clear = function(){
      console.log(this.length);
      for(var i = 0;i < this.length;++i)
        this.pop();
    function test(){
    ...
    
  4. clear()
    Array.prototype.clear = function () {
        this.length = 0;
    };
    ===?
    Array.prototype.removeAt = function (pos) {
        this.splice(pos, 1);
    };
    
  5. clear()
    Array.prototype.clear = function () {
        for (var i = 0, a = 0; i < this.length; i++) {
            this[i] = null;
        this.length = 0;
    };
    
  6. clear()
    Array.prototype.clear = function() {
      this.length = 0;
    };
    
  7. clear()
    Array.prototype.clear = function()
      this.splice(0, this.length);
    };
    
  8. clear()
    Array.prototype.clear = function() {
        while (this.length > 0) {
            this.pop();
    };