substr from end

I don’t seem to be able to return a substring from the end of a string.

For example

var string1 = “HelloWorld”;

This would actually return “Hello” rather than “World”.

Is there any other way I could do this? I have a work around which involves passing the length of the string and then subtracting the number of characters I want to start from but is there a cleaner way?


you can use slice function**.
**var string1 = “Hello World”;
Log.Information(string1.slice(-5)); // returns World
Log.Information(string1.slice(0,5)); // returns HelloRegards,