49 lines
820 B
TypeScript
49 lines
820 B
TypeScript
// const name: string = 'John';
|
|
// const age: number = 30;
|
|
// const isActive: boolean = true;
|
|
export const message = 'test';
|
|
const user = {
|
|
name: 'John',
|
|
};
|
|
|
|
console.log(age, isActive);
|
|
|
|
// name = "Alex";
|
|
let city = 'Berlin';
|
|
city = 'Frankfurt';
|
|
|
|
var address = {
|
|
city: 'Berlin',
|
|
};
|
|
|
|
function greet(name: string): string {
|
|
return `Hello, ${name}`; // "Hello " + name
|
|
}
|
|
|
|
console.log(greet('John'));
|
|
|
|
const zahl: number = 10;
|
|
|
|
if (zahl > 5) {
|
|
console.log('Zahl ist größer als 5');
|
|
} else if (zahl === 6) {
|
|
console.log('Zahl ist 6');
|
|
} else {
|
|
console.log('Zahl ist kleiner');
|
|
}
|
|
|
|
for (let i = 0; i < 3; i++) {
|
|
console.log(`Durchlauf: ${i}`);
|
|
}
|
|
|
|
function testVar() {
|
|
for (var i = 0; i < 3; i++) {
|
|
console.log(`i: ${i}`);
|
|
}
|
|
|
|
console.log(i);
|
|
}
|
|
|
|
console.log('test var: ', testVar());
|
|
export default {};
|