variable = "item_1";
label = variable.split('_');
result1 = label[0];
result2 = label[1];
console.log(result1);
console.log(result2);
Expected Output:
item
1
Actual Output:
i
t
I seem to be making a mistake somewhere, but I can't figure out where.
I have attempted the following:
- Experimenting with different quotation marks ' and "
- Assigning values to variables before use (variable = ''; name = [];
- Trying to split using a different character ('-')