Not working on scriptable but working good on other environments. Maybe the syntax is not correct. Scriptable shown this template when I write the code:
What error does it produce? Or what does it return?
The question mark behind the argument name means that the argument itself is optional. So you could technically call it without any arguments, but I currently don’t know what it then does…
First, split("\n")[0] definitely does work in Scriptable, as you can see if you run this short bit of test code:
a = `First line
Second line
Third line
Fourth line`;
b = a.split("\n")[0];
console.log(b);
So if it’s “not working” for you, the problem is likely to be either
The variable you’re applying split to doesn’t contain the text you think it does.
The text doesn’t use the linefeed character to separate lines.
Sometimes lines are separated by a combination of carriage return and linefeed characters; less common is a carriage return by itself. It depends on where the text came from. If the separator is the problem, there are ways to handle that.
But, as @schl3ck suggests, without seeing your code or the data it’s operating on, we don’t have enough information to help you.
I’m unfamiliar with the [b] = construction. Is it basically a case that it’s throwing away every element of the list other than the first (which it stores in b)?