progs/ap2.js
changeset 531 35ffb7a7eafa
parent 174 e2180cead443
--- a/progs/ap2.js	Mon Sep 25 17:16:56 2017 +0100
+++ b/progs/ap2.js	Tue Sep 26 10:36:19 2017 +0100
@@ -5,7 +5,7 @@
 app.use(cookie());
 
 app.get('/', function(req, res){
-    var counter =  parseInt(req.cookies.counter) || 0;
+    var counter =  parseInt(req.cookies.counter || "") || 0;
     res.cookie('counter', counter + 1);
     if (counter >= 5) {
         res.write('You are a valued customer ' +