Skip to content

Instantly share code, notes, and snippets.

@leegeunhyeok
Created December 17, 2025 18:36
Show Gist options
  • Select an option

  • Save leegeunhyeok/0bea0de5782070fda92e45cbab89f8f1 to your computer and use it in GitHub Desktop.

Select an option

Save leegeunhyeok/0bea0de5782070fda92e45cbab89f8f1 to your computer and use it in GitHub Desktop.
Hermes V1 (250829098.0.4) Block Scoping Test
const values = ['a', 'b', 'c'];
const captures = {};
for (let i = 0; i < values.length; i++) {
const value = values[i];
captures[value] = () => {
console.log(value);
};
}
typeof HermesInternal !== 'undefined' && console.log('Running on', HermesInternal.getRuntimeProperties()['OSS Release Version'])
captures.a();
captures.b();
captures.c();
// Output (Hermes):
// Running on 250829098.0.4
// c
// c
// c
//
// Output (V8):
// V8
// a
// b
// c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment