functies toegevoegt
This commit is contained in:
@@ -1,21 +1,28 @@
|
|||||||
# typescript funties
|
# typescript funties
|
||||||
|
|
||||||
|
|
||||||
* "let bruh;" met "let" declare je een variabel
|
* ```"let bruh;"``` met "let" declare je een variabel
|
||||||
|
* ```console.log("hi")``` nu kom er hi in je console terecht als je dit draait.
|
||||||
|
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
let guess;
|
let guess;
|
||||||
|
|
||||||
|
|
||||||
guess = "blue";
|
guess = "blue";
|
||||||
guess = 7;
|
guess = 7;
|
||||||
|
|
||||||
```
|
```
|
||||||
|
* door de vraagteken gaat de functie naar 'not ready' omdat er niks ingevult kan worden bij status
|
||||||
|
```typescript
|
||||||
|
function proclaim(status?: string) {
|
||||||
|
console.log(`I'm ${status || 'not ready...'}`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Een variabel kan alles zijn in typescript. Het is "any" je kan het later altijd een type geven
|
Een variabel kan alles zijn in typescript. Het is "any" je kan het later altijd een type geven
|
||||||
|
|
||||||
```mermaid
|
er zijn 3 verschillende soorten datatypes
|
||||||
graph TD;
|
* string
|
||||||
A-->B;
|
* number
|
||||||
A-->C;
|
* boolean
|
||||||
B-->D;
|
|
||||||
C-->D;
|
|
||||||
```
|
|
||||||
|
Reference in New Issue
Block a user