fixing up readmes for 1st two steps per feedback

This commit is contained in:
Ken
2019-02-26 14:04:15 -08:00
parent 9cef35ef70
commit f695291070
4 changed files with 108 additions and 11 deletions

View File

@@ -142,21 +142,21 @@ Please complete all exercises inside the `exercise/src` folder unless otherwise
3. Inside the file from (step 2), write a function called `fib(n)` that takes in a number and returns a the n-th Fibonacci number - be sure the specify the type of n
> HINT: fib(n) = fib(n - 1) + fib(n - 2); fib(n <= 1) = n;
> HINT: function fib(n: number) { return n <= 1 ? n : fib(n - 1) + fib(n - 2); }
4. Export `fib(n)` as a **named export**
5. Export another const variable as a **default export**
6. Import both the modules created in steps (4) and (5) and use the provided `log()` function to log it onto the page.
6. Inside `index.ts` Import both the modules created in steps (4) and (5) and use the built-in `console.log()` function to log the result of `fib(FibConst)`.
## Types, Interfaces, and Classes
Create inside `index.ts`:
Inside `index.ts`:
1. a type alias for string union type describing the states of Red-Green-Yellow traffic light: `type TrafficLight = ???`
1. Add a type alias for string union type describing the states of Red-Green-Yellow traffic light: `type TrafficLight = ???`
2. describe a type of car with an interface: `interface Car { ... }`
2. Describe a type of car with an interface: `interface Car { ... }` complete with `wheels`, `color`, `make`, `model`
## Generic
@@ -164,7 +164,7 @@ Inside `stack.ts`, create a generic class for a `Stack<T>` complete with a typed
> 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>`
Be sure to use the built-in `console.log()` to show the functionality of `Stack<T>`
## Spread and Destructure

View File

@@ -0,0 +1,5 @@
// TODO: create a named export of a function called fib(n)
// export function fib(n: number) ...
// TODO: create a default export of a constant of a number
// export default ...

View File

@@ -1,3 +1,6 @@
// TODO: import the fib(n) function and the constant from './fibonacci.ts'
// import {fib}, FibConst from ...
// Some setup code for exercises
const obj1 = {
first: 'who',