G

Variabel.js

public
Guest Aug 13, 2024 Never 79
Clone
JavaScript Variabel.js 41 lines (25 loc) | 680 Bytes
1
function getData(){
2
let data1 = parseFloat(document.getElementById("data1").value)
3
let data2 = parseFloat(document.getElementById("data2").value)
4
document.getElementById("hasil").innerHTML = data1+data2
5
console.log(data1+data2)
6
}
7
8
function angkaSatu(){
9
document.getElementById("data2").value = 1
10
}
11
12
13
14
15
16
17
18
19
function showName(){
20
21
// if(true){
22
// var x = "Halo x"
23
// let y = "Halo y"
24
// console.log(y)
25
// }
26
27
// console.log(x)
28
// console.log(y)
29
30
let nF = 10
31
let nL = "10"
32
let fN = nF + nL
33
34
console.log(fN)
35
36
const phi = 3.14
37
console.log(phi)
38
39
}
40
41
// showName()