JSFiddle - React, Tailwind, and code Playground

by Jon Kittell

JavaScript

debugger;

function Write() {
    debugger;
    var theString = arguments[0];
    for (var i = 1; i < arguments.length; i++) {
        var regEx = new RegExp("\\{" + (i - 1) + "\\}", "gm");
        theString = theString.replace(regEx, arguments[i]);
    }
    
    return theString;
};

var temperatures = [0, 15, 70, 89, 14, 43, 86 ];
var message = Write("Today's High Temperatures: {0}", temperatures);
alert(message);