This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Global | |
| const numbers = [1, 2, 3, 4, 5, 6] | |
| const number = (n) => { | |
| return numbers[n] | |
| } | |
| console.log(number(4)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CLASSES | |
| class Dog { | |
| constructor() { | |
| this.sound = 'woof'; | |
| } | |
| talk() { | |
| console.log(this.sound); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function App() { | |
| const useFormInput = initialValue => { | |
| const [value, setValue] = useState(initialValue); | |
| const handleChange = event => setValue(event.target.value); | |
| return { value: value, onChange: handleChange }; | |
| }; | |
| const name = useFormInput(''); | |
| const password = useFormInput(''); |
OlderNewer