doing step 4 demo notes

This commit is contained in:
Ken
2019-02-22 15:02:53 -08:00
parent 61f7eb6ce5
commit 79fdc8cd47
8 changed files with 63 additions and 29 deletions

View File

@@ -152,17 +152,15 @@ Please complete all exercises inside the `exercise/src` folder unless otherwise
Create inside `index.ts`:
1. a type alias for string union type describing the states of Red-Green-Yellow traffic light
1. a type alias for string union type describing the states of Red-Green-Yellow traffic light: `type TrafficLight = ???`
2. a class hierarchy of your favorite metaphor (e.g. family, autombiles, animals)
3. describe an object type with an interface
2. describe a type of car with an interface: `interface Car { ... }`
## Generic
Inside `index.ts`, create a generic class for a `Stack<T>` complete with a typed `pop()` and `push()` methods
Inside `stack.ts`, create a generic class for a `Stack<T>` complete with a typed `pop()` and `push()` methods
Hint: the Javascript array already has `push()` and `pop()` implemented for you. That can be your backing store.
> Hint: the Javascript array already has `push()` and `pop()` implemented for you. That can be your backing store.
Be sure to use the provided `log()` to show the functionality of `Stack<T>`

View File

@@ -0,0 +1,10 @@
// TODO: create a Stack<T> generic class here:
/**
*
* export class Stack<T> {
* push(...) { ... }
* pop(...) { ... }
* }
*
*/