Javascript String formatformat()

Description

Javascript String formatformat()


String.prototype.format = String.prototype.format || function format() {
    var args = arguments;

    return this.replace(/\{(\d+)\}/g, function($0, $1) {
        return args[+$1];
    });//from w  w w  .  j  ava  2  s.  co m
};



PreviousNext

Related