-
Couldn't load subscription status.
- Fork 0
String.prototype.format()
Marcel Kloubert edited this page Feb 13, 2015
·
3 revisions
Handles the string as format string and returns the formatted version.
The behaviour is similar to the String.Format() method of the .NET-Framework.
String.prototype.format([...args]);| Name | Type | Description |
|---|---|---|
| args | mixed | One or more argument for the format string. |
The formatted string.
// 'MK+TM'
var res1 = '{0}+{1}'.format('MK', 'TM');
// '1*2*3=6'
var res2 = '{1}*{3}*{0}={2}'.format(3, 1, 6, 2);