const-declarations-shadowing-parameter-name-let-const-and-var-variables.js (638B)
1 // Copyright (C) 2011 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 13.1 5 description: > 6 const declarations shadowing parameter name, let, const and var variables 7 ---*/ 8 function fn(a) { 9 let b = 1; 10 var c = 1; 11 const d = 1; 12 { 13 const a = 2; 14 const b = 2; 15 const c = 2; 16 const d = 2; 17 assert.sameValue(a, 2); 18 assert.sameValue(b, 2); 19 assert.sameValue(c, 2); 20 assert.sameValue(d, 2); 21 } 22 23 assert.sameValue(a, 1); 24 assert.sameValue(b, 1); 25 assert.sameValue(c, 1); 26 assert.sameValue(d, 1); 27 } 28 fn(1); 29 30 31 reportCompare(0, 0);