forked from WBWeb/FullStackWebDevelopment
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlearn-to-code.js
More file actions
76 lines (65 loc) · 1.78 KB
/
Copy pathlearn-to-code.js
File metadata and controls
76 lines (65 loc) · 1.78 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
//var name = "Jack";
//var age = 23;
//
//var message = "Hi, my name is " + name + " and I am " + age + " years old";
//console.log(message);
//var age = 23;
//var sum = 10 + 15;
//var sub = 15-10;
//var mult = 10*3;
//var div = 9/3;
//var remain = 10%4;
//
//
//console.log(sum,sub,mult,div,remain);
var accBalance = 300;
var nikeSBShoes = 780.99;
var coupon = 500;
//if (nikeSBShoes <= accBalance) {
// accBalance -= nikeSBShoes;
// console.log("We just bought some dope shoes!" + " Your current account balance is " + accBalance);
//} else if (nikeSBShoes -coupon <=accBalance) {
// console.log("We just bought some dope shoes with a coupon!");
// accBalance -= nikeSBShoes - coupon;
// console.log("Account balance: " + accBalance);
//}
//
//else {
// console.log("You too broke for the shoes");
//}
//var age = 23;
//var joesAge = "23";
//
//if (age !== joesAge) { /* === is used */
// console.log("These are not the same");
//} else {
// console.log("One is like the other");
//}
/*FUNCTIONS*/
var length1 = 15;
var length2 = 19;
var area1 = length1 * length2;
console.log(area1);
//Creating a function
function area(length, width) {
return length * width;
}
console.log(area(10,32));
var rectanglesAreas = [];
rectanglesAreas.push(area(10,23));
rectanglesAreas.push(area(10,2));
rectanglesAreas.push(area(5,23));
console.log("The area of the different rectangles are " + rectanglesAreas);
var bankBalance = 500;
function makeTransaction(priceOfSale) {
if (priceOfSale <= bankBalance) {
bankBalance -= priceOfSale;
console.log("Purchase Successful" +"\n" + "Remaining balance = " + bankBalance);
} else {
console.log("Insufficient Funds");
}
}
makeTransaction(79.00);
makeTransaction(2.99);
makeTransaction(10.99);
makeTransaction(950);