-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscope.js
More file actions
43 lines (34 loc) · 862 Bytes
/
scope.js
File metadata and controls
43 lines (34 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-disable no-alert, no-undef, no-const-assign, no-console, no-unused-vars, no-redeclare, no-func-assign */
const lg = require("./simple_module");
lg("Hello");
// Function scope
function createAnimal(name, weight) {
if(weight != undefined && name != undefined)
{
const newAnimal = createAnimal(name, weight);
}
function createAnimal(name, weight) {
//Bug Bug newAnimal should not exist and throw error
newAnimal = { name, weight };
return newAnimal;
}
return newAnimal;
}
//var a = Animal("Cat", 23);
//console.log(a.name + " " + a.weight);
function scope(start)
{
if(start != undefined)
{
let counter = start;
let c = 0;
}
while(counter < 10)
{
console.log(counter);
c += counter;
counter++;
}
return c;
}
scope();