Nodejs String Length Check isLengthGreaterThan(limit)

Here you can find the source of isLengthGreaterThan(limit)

Method Source Code

// you can add properties, but be careful not to override existing ones
String.prototype.isLengthGreaterThan = function(limit) {
   // 'this' is pointing at your string object
    return this.length > limit;  
}

console.log("John".isLengthGreaterThan(3));

Number.prototype.isPositive = function() {
    return this > 0;   
}

3.isPostive(3); // will return an error, even though a string might work in something similar, but
a.isPositive() // would work

Related

  1. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
      return this.length > limit;
    console.log("john".isLengthGreaterThan(3));
    
  2. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
        return this.length > limit;  
    console.log("John".isLengthGreaterThan(3));
    Number.prototype.isPositive = function() {
        return this > 0;   
    
  3. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
      return this.length > limit; 
    console.log("Ringo".isLengthGreaterThan(3));
    Number.prototype.isPositive = function() {
      return this > 0;
    var n = new Number(3);
    console.log(n.isPositive());
    ...
    
  4. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
        return this.length > limit;
    console.log('John'.isLengthGreaterThan(3));
    Number.prototype.isPositive = function() {
        return this > 0;
    var a = new Number(3);
    console.log(a.isPositive());
    ...
    
  5. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
        return this.length > limit;
    console.log("John".isLengthGreaterThan(3));
    Number.prototype.isPositive = function() {
        return this > 0;
    
  6. isLengthGreaterThan(limit)
    String.prototype.isLengthGreaterThan = function(limit) {
      return this.length > limit;
    console.log("John".isLengthGreaterThan(3));
    Number.prototype.isPositive = function() {
      return this > 0;
    var a = new Number(3);
    console.log(a.isPositive());
    ...
    
  7. isLengthGreatherThan(limit)
    'use strict';
    String.prototype.isLengthGreatherThan = function(limit) {
      return this.length > limit;
    };
    console.log('John'.isLengthGreatherThan(3));
    Number.prototype.isPositive = function() {
        return this > 0;
    };
    var a = -3;
    ...