That's because your solution has a bug. It does not work for a following test case either: assert.strictEqual(duplicateEncode("aA"),"))");
assert.strictEqual(duplicateEncode("aA"),"))");
The error message is this:
TypeError: text.toLowerCase(...).replaceAll is not a function
And that's because replaceAll requires Node v15 or higher: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility
replaceAll
Loading collection data...
That's because your solution has a bug. It does not work for a following test case either:
assert.strictEqual(duplicateEncode("aA"),"))");
The error message is this:
And that's because
replaceAll
requires Node v15 or higher: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility