mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
fixing up readmes for 1st two steps per feedback
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
5
step2-01/exercise/src/fibonacci.ts
Normal file
5
step2-01/exercise/src/fibonacci.ts
Normal 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 ...
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user