Extracts a segment at the requested index after dividing the input.
Negative indexes count backward from the final segment, matching Array.prototype.at semantics.
Array.prototype.at
String or array of strings to divide.
Zero-based segment index to select.
Separators and optional segment-processing options.
Selected segment, or an empty string for an invalid or missing index.
dividerAt('first/middle/last', 1, '/') // returns 'middle'dividerAt('first/middle/last', -2, '/') // returns 'middle' Copy
dividerAt('first/middle/last', 1, '/') // returns 'middle'dividerAt('first/middle/last', -2, '/') // returns 'middle'
Extracts a segment at the requested index after dividing the input.
Negative indexes count backward from the final segment, matching
Array.prototype.atsemantics.