Variable 'device' should be initialized on declaration
916 * @memberof ViewManager
917 */
918 loadDeviceFromJSON(json) {
919 let device; 920 Registry.viewManager.clear();
921 // Check and see the version number if its 0 or none is present,
922 // its going the be the legacy format, else it'll be a new format
Variable 'feature' should be initialized on declaration
401 // Find all the edge features
402 const edgefeatures = [];
403 const devicefeatures = Registry.currentDevice.layers[0].features;
404 let feature; 405
406 for (const i in devicefeatures) {
407 feature = devicefeatures[i];
Description
In JavaScript, variables can be assigned during declaration, or at any point afterwards using an assignment statement. For example, in the following code, foo
is initialized during declaration, while bar
is initialized later.
var foo = 1;
var bar;
if (foo) {
bar = 1;
} else {
bar = 2;
}
Bad Practice
function foo() {
var bar;
let baz;
}
Recommended
function foo() {
var bar = 1;
let baz = 2;
const qux = 3;
}