JSFiddle - React, Tailwind, and code Playground

by gianlucaguarini

JavaScript

function chain(val) {
  this.value = val
  this.toString = function() {
    return this.value
  }
  this.upperCase = function() {
      this.value = this.value.toUpperCase()
      return this
  }
  this.removeNumbers = function() {
      this.value = this.value.replace(/[0-9]/gim, '')
      return this
  }
  return this
}


alert(chain('hello    3 4 -4').upperCase().removeNumbers())