Looking to extract specific data from an array?
var data = new Array("1111_3", "1231_54", "1143_76", "1758_12");
If you want to extract just the numbers before the underscore in data[0] (1111), you can use the following method:
var ids = new Array();
// example: ids = Array("1111", "1231", "1143", "1758");
This code snippet will copy all the extracted numbers into the 'ids' Array. Do you need a PHP-like solution, or is using loops the best approach?
Thank you!