-
Notifications
You must be signed in to change notification settings - Fork 0
/
mio.ts
31 lines (28 loc) · 905 Bytes
/
mio.ts
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
interface Persona{
name: string,
age: number
}
class Main{
personas: Persona[]=[];
constructor(){
let btnAdd = document.getElementById("addItem");
let btnPrint = document.getElementById("print");
btnAdd.addEventListener("click", (e:Event) => this.add());
btnPrint.addEventListener("click", (e:Event) => this.print());
}
public add(){
console.log("addToArray");
console.log((<HTMLInputElement>document.getElementById("name")).value);
console.log((<HTMLInputElement>document.getElementById("age")).value);
}
public print(){
console.log("printArray");
console.log(this.personas);
}
/*
document.getElementById("addItem").onclick = function() {
var userInput = prompt("Enter your Todo: ");
personas.push = userInput;
console.log(personas);
}*/
}