48 mainNav.classList.add('d-none');
49 });
50
51 modal.addEventListener('hidden.bs.modal', function (event) {52 mainNav.classList.remove('d-none');
53 });
54 }
44
45 for (var modal of modals) {
46
47 modal.addEventListener('shown.bs.modal', function (event) {48 mainNav.classList.add('d-none');
49 });
50
17
18 // Closes responsive menu when a scroll trigger link is clicked
19 for (var item of navbarItems) {
20 item.addEventListener('click', function (event) {21 collapse.hide();
22 });
23 }
Found variables that are declared but not used anywhere.
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
var y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
var z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
var x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}