I am pretty sure has worked before, as I have sucessfully inserted multiple values with all spaces replaced with “-”
But this piece of code didn’t work anymore (also not when moved to Page Code).
As it turns out String.prototype.replaceAll() function is undefined in the Wix namespace.
This Javascript feature has been supported by all major browsers for quite some time now.
Why has it gone missing from Wix and what version of Javascript are we really using in Wix?
It seems it is working in Page Code, but it is not working in backend code.
Tried my own backend/application.jsw and the backend/data.js
Functional testing shows the error. If I invoke this code from page code, I only get “ERROR” in Site Monitoring.
export function test (){ var teststring = “my string” var result = teststring . replaceAll ( " " , “-” );
}
@jonatandor35 Thanks very much for your answer, that explains alot!
Do you also happen to know when Node 15 (released 2020-10-20) will be used in Wix?
Perhaps the docs should inform devs about the fact that serverside javascript uses an older Javascript engine than the browser?
Could have saved me some time
@jonatandor35 I have tried replace and split and join in my backend code to replace slashes "" in some of my strings and it does not seem to work? Anyone else have this issue?
@jonatandor35 oh and I can replace any other character just now a forward slash. Here is below a sample test code I have been playing with. Also, another weird thing is the first log statement doesn’t even show all the slashes “"? This is the message from the log " [“Test:”,”\this is a \test \this is a \test"]".