From 11972825b88959e3969e7b60c0bd80be42f20726 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Sun, 1 Aug 2021 00:48:11 +0000 Subject: [PATCH] Tweaked TypeScript example code in readme to use more modern const/let instead of var. --- Readme.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index e620ea0..e4a28b8 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -69,17 +69,17 @@ TypeScript/JavaScript languages: ```typescript // Name abbreviated for the sake of these examples here -var QRC = qrcodegen.QrCode; +const QRC = qrcodegen.QrCode; // Simple operation -var qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM); -var svg = toSvgString(qr0, 4); // See qrcodegen-input-demo +const qr0 = QRC.encodeText("Hello, world!", QRC.Ecc.MEDIUM); +const svg = toSvgString(qr0, 4); // See qrcodegen-input-demo // Manual operation -var segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383"); -var qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false); -for (var y = 0; y < qr1.size; y++) { - for (var x = 0; x < qr1.size; x++) { +const segs = qrcodegen.QrSegment.makeSegments("3141592653589793238462643383"); +const qr1 = QRC.encodeSegments(segs, QRC.Ecc.HIGH, 5, 5, 2, false); +for (let y = 0; y < qr1.size; y++) { + for (let x = 0; x < qr1.size; x++) { (... paint qr1.getModule(x, y) ...) } }