-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegers.js
More file actions
34 lines (32 loc) · 818 Bytes
/
integers.js
File metadata and controls
34 lines (32 loc) · 818 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
var binaryInt = 0b010101000,
octalInt = 07,
decimalInt = 34,
hexInt = 0xAA;
console.log("Nilai inisialisasi");
console.log("==================\n");
console.log("Binary: " + binaryInt);
console.log("Octal: " + octalInt);
console.log("Decimal: " + decimalInt );
console.log("Hex: " + hexInt);
console.log("\nNilai setelah ditambah");
console.log("======================\n");
console.log("Binary + 2: " + (binaryInt + 2));
console.log("Octal + 8: " + (octalInt + 8));
console.log("Decimal + 11: " + (decimalInt + 11));
console.log("Hex + 0xE: " + (hexInt + 0xE));
// Hasil:
// Nilai inisialisasi
// ==================
//
// Binary: 168
// Octal: 7
// Decimal: 34
// Hex: 170
//
// Nilai setelah ditambah
// ======================
//
// Binary + 2: 170
// Octal + 8: 15
// Decimal + 11: 45
// Hex + 0xE: 184