* Fix plugin-transform-block-scoping const violations Fixes #13245 * Replace `a++` with `+a` where const violation * Remove assignment where const violation * Remove assignment for `&&=`, `||=`, `??=` where const violation * Shorten test
17 lines
332 B
JavaScript
17 lines
332 B
JavaScript
const state = {};
|
|
function f(arr) {
|
|
const MULTIPLIER = 5;
|
|
state.getMultiplier = () => MULTIPLIER;
|
|
|
|
for (MULTIPLIER in arr);
|
|
|
|
return 'survived';
|
|
}
|
|
|
|
expect(function() {
|
|
f([1,2,3]);
|
|
}).toThrow('"MULTIPLIER" is read-only');
|
|
expect(state.getMultiplier()).toBe(5); // Assignment did not succeed
|
|
|
|
expect(f([])).toBe('survived');
|