I have this Code in my Javascript File:
const blfTypeAndId = DDid.split("PrerequisitesSelect");
const blfType = blfTypeAndId[0];
const blfId = blfTypeAndId[1];
The blfType is after this either 'block', 'line' or 'field' and the blfId is _B1_L1_F1 while the numbers can be different (this is just for field, for line it would be _B1_L1 and block just _B1)
In a world where Python and Javascript are combined I would just do this:
const blfType, const blfId = DDid.split("PrerequisitesSelect");
Is there a nice way in Javascript to still do this in one line or is my first written code already the best possible solution?
A good job for the Destructuring Assignment
const blfTypeAndId = DDid.split("PrerequisitesSelect");
const [blfType, blfId] = blfTypeAndId;
or even just
const [blfType, blfId] = DDid.split("PrerequisitesSelect");