10function main() {
11 let count = 1;
12 for (let j = 1; j <= 20; j++) {
13 count *= Math.floor(i / gcd(i, count));14 };
15 return count;
16};
2 while (b != 0) {
3 c = a % b;
4 a = b;
5 b = c; 6 }
7 return a;
8}
1function gcd(a, b) {
2 while (b != 0) {
3 c = a % b; 4 a = b;
5 b = c;
6 }
10function main() {
11 let count = 1;
12 for (let j = 1; j <= 20; j++) {
13 count *= Math.floor(i / gcd(i, count));14 };
15 return count;
16};
1function smallestFactor(x) {
2 for (i = 2; i <= Math.floor(x**.5); i++) { 3 if (x % i == 0) {
4 return i;
5 };
Variables that aren't defined, but accessed may throw reference errors at runtime.
NOTE: In browser applications, DeepSource recommends the use of ESModules over regular
text/javascript
scripts. Using variables that are injected by scripts included in an HTML file is currently not supported.
Potential ReferenceError
s may result from misspellings of variable and parameter names, or accidental implicit globals (for example, forgetting the var
keyword in a for
loop initializer).
Any reference to an undeclared variable causes a warning, unless the variable is explicitly mentioned in a /*global ...*/
comment, or specified in the globals key in the ESLint configuration file.
A common use case for these is if you intentionally use globals that are defined elsewhere (e.g. in a script sourced from HTML).
const foo = someFunction(); // `someFunction` is not defined
const bar = baz + 1; // 'baz' is undeclared
import { someFunction } from 'some-file';
const baz = Math.random();
const foo = someFunction();
const bar = baz + 1;