tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

capturing-closure-variables-1.js (375B)


      1 // Copyright 2015 Microsoft Corporation. All rights reserved.
      2 // This code is governed by the license found in the LICENSE file.
      3 
      4 /*---
      5 description: Capturing closure variables
      6 es6id: 14.2
      7 ---*/
      8 
      9 var a;
     10 function foo(){
     11    eval("a = 10");
     12    return ()=>a;
     13 }
     14 
     15 assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly.");
     16 
     17 reportCompare(0, 0);