1
votes

I found a difference between Lotus Domino SSJS iterpretation and regular Javascript.

Look at this snippet...

var mister = "mister in the hat".replace(" ", "-");
return mister

Regular Javascript does replave only once. The result is "mister-in the hat". SSJS does full replace. The result is "mister-in-the-hat".

Is there any documentation, in what way the SSJS is diferent from regular JS?

1
@JiKra: Try to use var mister = "mister in the hat".replaceFirst(" ", "-"); instead.Sven Hasselbach
@freakish - I think you should do research before making a uninformed statement like that. It doesn't help the OP - and using Node.js as a reference is about as helpful as saying "I tried it in Logo and it works great, dunno what your problem is"Jeremy Hodge

1 Answers

8
votes

I suspect Server-Side JavaScript will be influenced more by Java rather than JavaScript. This is because any SSJS written is just passed as a string to a Java method that parses the code at runtime. I know of ither differences to CSJS - parseInt, for example, defaults to base 10, not base 8 (JavaScript default).

The behaviour is documented in the Domino Designer help, under Lotus Domino Designer XPages Reference - Standard (JavaScript) - String - Replace. If in doubt, check out the Help. It's very good for these libraries, with plenty of examples as well as documentation.