-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
131 lines (100 loc) · 3.26 KB
/
index.js
File metadata and controls
131 lines (100 loc) · 3.26 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//var date = new Date(); // Varible declaration
//document.getElementById("demo1").innerHTML = "<h1>Today is: " + date + "</h1>" /* Long Variable Comments */
//var a;
//var b;
//var sum;
//a = 5;
//b = 4;
//sum = a + b;
//document.getElementById("demo").innerHTML = sum;
//let name = 'Roland ';
//console.log(name);
//const interestRate = 0.3;
//console.log('interestRate');
//let name = 'Roland'; // String Literal
//let age = 30; // Number Literal
//let isApproved = false; // Boolean Literal
//let firtnName = undefined;
//let selectedColor = null;
//console.log('name');
//console.log('age');
//console.log('isApproved');
//console.log('selectedColor');
//let person = {
//name: 'Roland',
//age: 39
//};
// Dot Notation use this style
//person.name = 'name';
// Bracket Notation
//let selection = 'name';
//person [selection] = 'Mary';
// console.log(person.name);
//let selectedColors = ['red','blue'];
//selectedColors[2] = '1';
//console.log(selectedColors);
// Get Current Computer Time
//var date = new Date(); // Varible declaration
//document.getElementById("id1").innerHTML = "<h1>Today is: " + date + "</h1>" //Alert JavaScript
//console.log(date);
// Addition
//document.getElementById("r1").innerHTML = 5 * 6 + 777 - 38 ; //5 + 6
//console.log();
// Multiplication
//document.getElementById("r2").innerHTML = 5 * 6; //5 + 6
//console.log();
// Multiplication
//document.getElementById("r3").innerHTML = 5 / 6; //5 + 6
//console.log();
// Get Reminder
//document.getElementById("r4").innerHTML = 5 % 6; //5 + 6
//console.log();
// Get Reminder
//document.getElementById("r5").innerHTML = 4 * 3 * 6 + 6; //5 + 6
//console.log();
// Get Reminder
//document.getElementById("r6").innerHTML = 55 * 35 * 45 - 34; //5 + 6
//console.log();
// Regular Function, call explicityl by name:
//function multiply(a,b) {
// code here
//var results = 3 * 4;
//console.log("2 multiplied by 4 is", results);
//}
//multiply();
// Anonymous function stored in variable
// Invoked by calling the variable as a funtion
//var divided = function () {
// code here
//var results = 3 / 4;
//console.log("3 divided by 4 is", results);
//}
//divided();
// Immidiately Invoked Function Experession.
// Runs as soon as the browser finds it:
//(function () {
// code here
//var results = 12 / 0.75;
//console.log("12 divided by 0.75 is", results);
//}())
//function findBiggestFraction () {
//a>b ? console.log("a:", a) : console.log ("b:",b);
//}
//var firstFraction = 3/4;
//var secondFraction = 5/7;
//findBiggestFraction(firstFraction, secondFraction);
//findBiggestFraction(7/16,13/25);
//findBiggestFraction(1/2,3/4);
//document.getElementById("f1").innerHTML = findBiggestFraction();
onclick="document.getElementById('f8').innerHTML = Date()"
onclick='document.getElementById("f9").innerHTML = "Hello JavaScript!"'
onclick="document.getElementById('myImage').src='pic_bulbon.gif'"
onclick="document.getElementById('myImage').src='pic_bulboff.gif'"
onclick="document.getElementById('f10').style.fontSize='35px'"
onclick="document.getElementById('f11').style.display='true'"
document.getElementById("f13").innerHTML = "My First JavaScript"
// Another Function
onclick="myText1()"
function myText1() {
document.getElementById("f15").innerHTML = "Paragraph changed.";
}