-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.html
More file actions
67 lines (46 loc) · 1.14 KB
/
functions.html
File metadata and controls
67 lines (46 loc) · 1.14 KB
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
67
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var firstName = "Fer";
var lastName = "Mendoza";
var ferAge = 17;
// this is a void function, does not return anything
function showInfo(age, city) {
console.log(firstName + " " + lastName);
if(age != 0){
console.log("Age: " + age);
}
if(city != "" && city != undefined){
console.log("City: " + city);
}
console.log(ferAge);
}
// Annon function and a return type function
var sum = function (a, b) {
return a + b;
}
showInfo();
var res = sum(1,2);
console.log(res);
// The variables created in here are local variables and could be used only inside the function
function innerScope(){
var phone = "210-XXX-XXXX";
}
function getAddress(){
var address = "Austin hwy";
return address;
}
innerScope();
// console.log(address);
console.log(getAddress());
// for (var i = 0; i < 100; i++){
// printName();
// }
</script>
</body>
</html>