-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday2.js
More file actions
76 lines (41 loc) · 952 Bytes
/
day2.js
File metadata and controls
76 lines (41 loc) · 952 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* functions
* -> definition
* -> call
*/
const dogA = {
name: 'skipper',
color: 'white',
sound: 'bow, bow, bow'
}
const catA = {
name: 'kitty',
color: 'white',
sound: 'meow, meow'
}
// function definition
function getSound(animal){
console.log(animal.sound);
}
// function call
getSound(dogA);
getSound(catA);
// function def
function simple(){
console.log('no parametrs');
}
// function call
simple();
// function definition as a variable/constant
const simpleFunctionTwo = function () {
console.log('simpleFunctionTwo');
};
simpleFunctionTwo();
// arrow functions
const simpleFunctionThree = () => {
console.log('simpleFunctionThree');
};
simpleFunctionThree();
// simple way of writing arrowfunctions , only allowed when we only have one line of code in the def
const simpleFunctionFour = () => console.log('simpleFunctionFour');
simpleFunctionFour();