Javascript String printf()

Description

Javascript String printf()


'use strict';/*from  w w w.  j  a v  a  2 s . c o m*/

String.prototype.printf = function() {
  var result = this;

  for (var i = 0; i < arguments.length; i++) {
    result = result.replace('_', arguments[i] === undefined ? '' : arguments[i]);
  }

  return result;
};



PreviousNext

Related