hack the web
level TS01
const zahl = 13
if (13 = zahl) { console.log('Lieblingszahl!')}const zahl = 13
if (13 == zahl) { console.log('Lieblingszahl!')}level TS02
const alter = 15
if (alter 18) { console.log('Kind')}const alter = 15
if (alter &18) { console.log('Kind')}level TS03
const einHalb = 0,5const einHalb = 0.5level TS04
variable = 2var iable = 2level TS05
const zahl: number = 101
const text: string = "htw"
const ups: number = "42"gold
const zahl: number = 101
const text: string = "htw"
//const ups: number = "42"hacker
learn about Bitwise NOT
The bitwise NOT (~) operator returns a number or BigInt whose binary representation has a 1 in each bit position for which the corresponding bit of the operand is 0, and a 0 otherwise.
const zahl: number = 101
const text: string = "htw"
const ups: number = ~"42"level TS06
function fn_42() { return 42}
const zahl: number = fn_42gold
function fn_42() { return 42}
const zahl: number = fn_42()hacker
zahl = -1 here
~fn_42 = ~Number(fn_42) = ~NaN = ~0 = -1function fn_42() { return 42}
const zahl: number = ~fn_42level TS07
const text = "Und sie fragte sich, was "Typescript" wohl bedeutet"const text = "Und sie fragte sich, was Typescript wohl bedeutet"level TS08
Ich mag viel lieber in Python programmieren
Hab ja einfach gar keinen Bock -_-Template Literals
`Ich mag viel lieber in Python programmieren
Hab ja einfach gar keinen Bock -_-`level TS09
learn about non-null assertion
let vielleichtText: string | null = null
if (Math.random() < 0.5) { /* ` ` */ vielleichtText = 'Juhu!'}
const sicherText: string = vielleichtText
console.log(sicherText)let vielleichtText: string | null = null
if (Math.random() < 0.5) { /* ` ` */ vielleichtText = 'Juhu!'}
const sicherText: string = vielleichtText!
console.log(sicherText)level TS010
const ergebnis = 11 + -(-3 - ((3 + 4) / 10) * 40const ergebnis = 11 + -(-3 - ((3 + 4) / 10) * 40)level TS011
interface Datum { tag: number monat: number jahr: number}
// ` So alt, dass schon Teile fehlen `const damals: Datum = { monat: 12, jahr: 1995,}learn about optional parameters
interface Datum { tag?: number monat: number jahr: number}
// ` So alt, dass schon Teile fehlen `const damals: Datum = { monat: 12, jahr: 1995,}level TS012
const zutaten = { apfel: 10, birne: 5, clementine: 3, dattel: 4,}
const salat = // Obst */``*/ salat und Buchstabenmix zutaten.apfel + zutaten.Apfel + zutaten.Clementine + zutaten.Clementine + zutaten.Clementine
console.log(salat)const zutaten = { apfel: 10, birne: 5, Clementine: 3, dattel: 4,}
const salat = // Obst */``*/ salat und Buchstabenmix zutaten.apfel + zutaten.apfel + zutaten.Clementine + zutaten.Clementine + zutaten.Clementine
console.log(salat)