diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index 1834294..520daad 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -513,7 +513,7 @@ var qrcodegen = new function() { var step = (version == 32) ? 26 : Math.ceil((size - 13) / (numAlign*2 - 2)) * 2; var result = [6]; - for (var i = 0, pos = size - 7; i < numAlign - 1; i++, pos -= step) + for (var pos = size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos); return result; } diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 1fbfa45..e2c1964 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -598,7 +598,7 @@ namespace qrcodegen { let step: int = (this.version == 32) ? 26 : Math.ceil((this.size - 13) / (numAlign*2 - 2)) * 2; let result: Array = [6]; - for (let i = 0, pos = this.size - 7; i < numAlign - 1; i++, pos -= step) + for (let pos = this.size - 7; result.length < numAlign; pos -= step) result.splice(1, 0, pos); return result; }