Continue front-end training guide
This commit is contained in:
parent
2bded29d82
commit
311255c312
@ -4,6 +4,13 @@ Note: run code quickly with https://codesandbox.io/s/
|
|||||||
|
|
||||||
## Quirks
|
## Quirks
|
||||||
|
|
||||||
|
### Printing and interacting with the console
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Do not leave console.log in your code! There are linters such as eslint that will check for their absence
|
||||||
|
console.log("hello");
|
||||||
|
```
|
||||||
|
|
||||||
### Comparing scalar, arrays, and objects
|
### Comparing scalar, arrays, and objects
|
||||||
|
|
||||||
#### Always use triple comparators (`===`) instead of double (`==`)
|
#### Always use triple comparators (`===`) instead of double (`==`)
|
||||||
@ -38,9 +45,19 @@ import _ from 'lodash'
|
|||||||
|
|
||||||
console.assert(_.isEqual({a: 1}, {a: 1}))
|
console.assert(_.isEqual({a: 1}, {a: 1}))
|
||||||
console.assert(_.isEqual([1, 2], [1, 2]))
|
console.assert(_.isEqual([1, 2], [1, 2]))
|
||||||
|
```
|
||||||
|
|
||||||
|
### `Object` methods
|
||||||
|
|
||||||
## Object assignment and destructuring
|
#### `Object.assign`, spread operator
|
||||||
|
|
||||||
|
`Object.assign` (ES 2015)
|
||||||
|
|
||||||
|
### `Array` methods
|
||||||
|
|
||||||
|
#### `Array.includes` (ES7)
|
||||||
|
|
||||||
|
## Object literals, assignment and destructuring
|
||||||
|
|
||||||
### Objects
|
### Objects
|
||||||
|
|
||||||
@ -54,6 +71,25 @@ console.assert(size === 2)
|
|||||||
// Get the rest with ...rest
|
// Get the rest with ...rest
|
||||||
const {color, brand, ...rest} = toaster;
|
const {color, brand, ...rest} = toaster;
|
||||||
console.assert(_.isEqual(rest, {size: 2}));
|
console.assert(_.isEqual(rest, {size: 2}));
|
||||||
|
|
||||||
|
// Set default
|
||||||
|
const {size2 = 3} = toaster
|
||||||
|
console.assert(size2 === 3)
|
||||||
|
|
||||||
|
// Rename variables
|
||||||
|
const {size: size3} = toaster
|
||||||
|
console.assert(size3 === 2)
|
||||||
|
|
||||||
|
// Enhances object literals
|
||||||
|
const name = 'Louis'
|
||||||
|
const person = {name}
|
||||||
|
console.assert(_.isEqual(person, {name: 'Louis'}))
|
||||||
|
|
||||||
|
// Dynamic properties
|
||||||
|
const person2 = {['first' + 'Name']: 'Olympe'}
|
||||||
|
console.assert(_.isEqual(person2, {firstName: 'Olympe'}))
|
||||||
|
// Btw, you can include quotes although nobody does this
|
||||||
|
console.assert(_.isEqual(person2, {'firstName': 'Olympe'}))
|
||||||
```
|
```
|
||||||
|
|
||||||
### Array
|
### Array
|
||||||
@ -141,10 +177,51 @@ const myFunctionToBeShortenedArrowV2 = a => a
|
|||||||
console.assert(myFunctionToBeShortenedArrowV2(1) === 1)
|
console.assert(myFunctionToBeShortenedArrowV2(1) === 1)
|
||||||
```
|
```
|
||||||
|
|
||||||
Best practices:
|
### How `this` works in arrow functions
|
||||||
|
|
||||||
|
### Best practices
|
||||||
|
|
||||||
- I usually keep the parameters parenthesis. If you add a parameter, you'll have to add them back.
|
- I usually keep the parameters parenthesis. If you add a parameter, you'll have to add them back.
|
||||||
|
|
||||||
|
## Classes
|
||||||
|
|
||||||
|
### Prototypal inheritance
|
||||||
|
|
||||||
|
## Template literals
|
||||||
|
|
||||||
|
### Template tags
|
||||||
|
|
||||||
|
## Loops
|
||||||
|
|
||||||
|
### `for... of`
|
||||||
|
|
||||||
|
Note: prefer using some functional constructs such as `map`, `reduce`, etc.
|
||||||
|
|
||||||
|
## Promises
|
||||||
|
|
||||||
|
### Creating a promise
|
||||||
|
|
||||||
|
### Consuming a promise
|
||||||
|
|
||||||
|
### Chaining promises
|
||||||
|
|
||||||
|
## Async functions
|
||||||
|
|
||||||
|
## Modules
|
||||||
|
|
||||||
|
CommonJS syntax:
|
||||||
|
|
||||||
|
ES Module syntax:
|
||||||
|
|
||||||
|
- default export and imports
|
||||||
|
- renaming imports
|
||||||
|
|
||||||
|
## TypeScript
|
||||||
|
|
||||||
|
### Differences between TypeScript and JavaScript
|
||||||
|
|
||||||
|
### An introduction to TypeScript's type system
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [ES5 to ESNext — here’s every feature added to JavaScript since 2015](https://www.freecodecamp.org/news/es5-to-esnext-heres-every-feature-added-to-javascript-since-2015-d0c255e13c6e/)
|
- [ES5 to ESNext — here’s every feature added to JavaScript since 2015](https://www.freecodecamp.org/news/es5-to-esnext-heres-every-feature-added-to-javascript-since-2015-d0c255e13c6e/)
|
||||||
|
9
training/front-end/02-react.md
Normal file
9
training/front-end/02-react.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# An introduction to React
|
||||||
|
|
||||||
|
## The inspiration for React
|
||||||
|
|
||||||
|
## React components
|
||||||
|
|
||||||
|
## An introduction to state management in React application
|
||||||
|
|
||||||
|
## Testing React applications
|
7
training/front-end/03-css-html-restart.md
Normal file
7
training/front-end/03-css-html-restart.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# CSS & HTML: restart
|
||||||
|
|
||||||
|
## An intro to modern technologies and methodologies
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### Accessibility
|
5
training/front-end/04-front-end-development-practices.md
Normal file
5
training/front-end/04-front-end-development-practices.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Front-end development practices
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
## Code style
|
Loading…
x
Reference in New Issue
Block a user