Skip to content

Consider converting from for-loops to forEach function calls #89

@1fifoto

Description

@1fifoto

For example

        if (!hits) {
            for (let i = 0; i < design.design_parameters.length; i++) {
                var dp = design.design_parameters[i];
                if (dp.name.startsWith(subcommand)) {
                    putdpsv(dp.name, dp.value, dp.units, dp);
                    hits = true;
                }
            }
        }

to

        if (!hits) {
            design.design_parameters.forEach(function(dp) {
                if (dp.name.startsWith(subcommand)) {
                    putdpsv(dp.name, dp.value, dp.units, dp);
                    hits = true;
                }
            }
        }

This is more of a Javascript idiom, and simplifies the code.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions