Tweaked TypeScript example code in readme to use more modern const/let instead of var.

pull/118/head
Project Nayuki 3 years ago
parent 6f68c21b1b
commit 11972825b8

@ -69,17 +69,17 @@ TypeScript/JavaScript languages:
```typescript ```typescript
// Name abbreviated for the sake of these examples here // Name abbreviated for the sake of these examples here
var QRC = qrcodegen.QrCode; const QRC = qrcodegen.QrCode;
// Simple operation // Simple operation
var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM); const qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM);
var svg = toSvgString(qr0, 4); // See qrcodegen-input-demo const svg = toSvgString(qr0, 4); // See qrcodegen-input-demo
// Manual operation // Manual operation
var segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383"); const segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383");
var qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false); const qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false);
for (var y = 0; y < qr1.size; y++) { for (let y = 0; y < qr1.size; y++) {
for (var x = 0; x < qr1.size; x++) { for (let x = 0; x < qr1.size; x++) {
(... paint qr1.getModule(x, y) ...) (... paint qr1.getModule(x, y) ...)
} }
} }

Loading…
Cancel
Save