DEV Community

Discussion on: How to make a qr-code generator with JavaScript

luigicampbell profile image

Neat idea! I also would have liked to see more of the nuts and bolts as I don't know much about we code generators. Maybe a brief example as to what they are and how they work before showing us how we could use one.

As for some suggestions, please understand my intent is to help here and to try and motivate.

Please read up on ES6 on 'let' vs 'const' for a better explanation but the important thing is to create something called block scope and also protect against weird side effects introduced by hoisting with the var instruction. As some general advice, try 'const' first and change to 'let' if you have to. Stay away from var unless you use it exclusively and/or are a solo coder.

Another tip is to either use only es5 and function keywords or arrow function syntax for call backs if you're gonna be using let and const anyway. Makes it look more consistent and familiar to a team which eases development and lowers development time (longer weekends!) Along this train of thought, look into design practices involving more descriptive variable and function names.

Keep it up!