I'm trying to replace a placeholder in a string I'm generating.
My string looks like this:
var s = 'module("SlapOS UI Basic Interaction"); ' +
'asyncTest( "${base_url}", function() { ' +
' expect( __number__ ); ' +
' ok(testForElement("div#global-panel"), "element present");' +
' start(); })';
And I want to replace __number__
.
I can get the index correctly like so:
s.indexOf("__number__");
but replacing does not work...
s.replace("__number__", "1");
Question:
What am I doing wrong here? Makes no sense to my why it does not work.