Check string ends with charAt function - Node.js String

Node.js examples for String:String End

Description

Check string ends with charAt function

Demo Code


String.prototype.endsWith = function endsWith(c){
  if(this.charAt(this.length - 1) == c){
    return true;//w w w  .j av a 2  s.  co  m
  } else {
    return false;
  }
};

Related Tutorials