mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-17 05:09:24 +08:00
9 lines
393 B
JavaScript
9 lines
393 B
JavaScript
// A shift guarded by the source array's length produces a runtime-optional
|
|
// string. Its property read extracts the present value and preserves Node's
|
|
// TypeError path if the algorithmic guard ever fails.
|
|
const values = ["alpha", "beta"];
|
|
while (values.length) {
|
|
const value = values.shift();
|
|
console.log(value.length, value[0], /^a/.test(value), value.indexOf("a"), value.slice(1));
|
|
}
|