-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
130 lines (114 loc) · 2.93 KB
/
index.js
File metadata and controls
130 lines (114 loc) · 2.93 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
121
122
123
124
125
126
127
128
129
130
console.log(
'%c Javascript!',
'font-size: 20px; background: #222; color: #bada55'
)
// Number
const number1 = 3
const number2 = 5
const number3 = 7
const number4 = 9
const number5 = 11
// Output Number
console.log('this is number ' + number1)
console.log('this is number ' + number2)
console.log('this is number ' + number3)
console.log('this is number ' + number4)
console.log('this is number ' + number5)
console.log('--------------------------')
// Addition
const result_multiplication = number1 * number2
const result_divide = number4 / number1
const result_addition = number3 + number4
const result_subtraction = number5 - number4
const result_modulus = number3 % number2
const result_exponentiation = number2 ** number1
// Output Addition
console.log(
`${number1} multiplied by ${number2} equals to ${result_multiplication}`
)
console.log(`${number4} divided by ${number1} equals to ${result_divide}`)
console.log(`${number3} added by ${number4} equals to ${result_addition}`)
console.log(
`${number5} substracted by ${number4} equals to ${result_subtraction}`
)
console.log(`${number3} modulus by ${number2} equals to ${result_modulus}`)
console.log(
`${number2} exponentiation by ${number1} equals to ${result_exponentiation}`
)
console.log('---------------------------')
// String
const string1 = 'Hello'
const string2 = 'coders'
const string3 = 'welcome'
const string4 = 'to'
const string5 = 'the'
const string6 = 'world'
const string7 = 'of'
const string8 = 'coding'
const result_string = `${string1} ${string2} ${string3} ${string4} ${string5} ${string6} ${string7} ${string8}`
// Output String
console.log(result_string)
console.log('---------------------------')
// Array
var arrayNumber = [1, 2, 3, 4, 5, 6, 7, 8, 9]
var arrayString = [
'one',
'two',
'tree',
'four',
'five',
'six',
'seven',
'eight',
'nine'
]
var date = new Date()
var stroller = [
{
brand: 'Pliko',
price: 650000,
color: 'Red',
stock: 6,
boolean: true,
dated: `${date.getDate()} - ${date.getMonth() + 1} - ${date.getFullYear()}`
},
{
brand: 'Does',
price: 825000,
color: 'Brown',
stock: null,
boolean: false,
dated: `${date.getDate()} - ${date.getMonth() + 1} - ${date.getFullYear()}`
},
{
brand: 'Elle',
price: 1250000,
color: 'Blue',
stock: 12,
boolean: true,
dated: `${date.getDate()} - ${date.getMonth() + 1} - ${date.getFullYear()}`
}
]
arrayNumber.push(10)
// Output Array
console.log(
`values arrayNumber is ${arrayNumber}, number of lengths ${
arrayNumber.length
}`
)
arrayString.push('ten')
console.log(
`values arrayNumber is ${arrayString}, number of lengths ${
arrayString.length
}`
)
stroller.push({
brand: 'Bugaboo',
price: 1500000,
color: 'Green',
stock: 10,
boolean: true,
dated: `${date.getDate()} - ${date.getMonth() + 1} - ${date.getFullYear()}`
})
console.log(stroller)
console.log(stroller[stroller.length - 1].brand + ' is a new brand')