1//(don't type behind the// type function to after that name it//
2function name() {
3 (name)=name
4 console.log(name)
5};
6//{ symbol is used o group together code but you must create n index/array of 2(array3)//
1function addfunc(a, b) {
2 return a + b;
3 // standard long function
4}
5
6addfunc = (a, b) => { return a + b; }
7// cleaner faster way creating functions!
8
1// Code by DiamondGolurk
2// Defining the function
3
4function test(arg1,arg2,arg3) {
5 // Insert code here.
6 // Example code.
7 console.log(arg1 + ', ' + arg2 + ', ' + arg3)
8}
9
10// Running the function
11
12test('abc','123','xyz');
13
14// Output
15// abc, 123, xyz
1// NOTE : Function defined using (Function CONSTRUCTOR) does not
2// inherits any scope other than the GLOBAL SCOPE
3
4var x=7;
5function A(){
6 var x=70;
7 function B(){
8 console.log(x); // 70
9 }
10 let C = function(){
11 console.log(x); // 70
12 }
13 let D = new Function('console.log(x)'); // user caps F
14
15 B(); // 70
16 C(); // 70
17 D();// 7 - Inherits always the GLOBAL scope
18};
19
20A();