Nodejs Array Empty Check isEmpty()

Here you can find the source of isEmpty()

Method Source Code

Array.prototype.isEmpty = function () {
  return this.length === 0
};

Array.prototype.last = function () {
  if (this.length === 0) return null;
  return this[this.length - 1];
};

Related

  1. isEmpty()
    Array.prototype.isEmpty = function(){
      return (this.length === 0 );
    
  2. isEmpty()
    Array.prototype.isEmpty = function() {
        return (0 === this.length);
    
  3. isEmpty()
    Array.prototype.isEmpty = function() {
      return this.length == 0;
    };
    
  4. isEmpty()
    Array.prototype.isEmpty = function() {
        return this.length == 0;