Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Lu committed Aug 20, 2024
1 parent 135c863 commit 18fcd88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Binary file added pages/hack-school/images/promises.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions pages/hack-school/js.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ let greeting = "say Hello instead";
if (true) {
let greeting = "say Hello instead";
console.log(greeting); // "say Hello instead"
//no error because differet scope
//no error because different scope
}

console.log(greeting); // "say Hi"
Expand Down Expand Up @@ -132,7 +132,7 @@ const organization = {
}
}
```
**We can acess properties of an object either through the dot notaion or the bracket notation**
**We can access properties of an object either through the dot notation or the bracket notation**

Accessing properties (dot notation):
```javascript copy showLineNumbers
Expand Down Expand Up @@ -361,6 +361,8 @@ A promise has a parameter that is known as the Executor function. This function

`reject`: This function is called when the asynchronous operation fails. It accepts a single argument, which is the reason (error) for the rejection.

![text-formatting-example](pages/hack-school/images/promises.png)

```javascript copy showLineNumbers
let checkLength = new Promise((resolve, reject) => {
let sentence = "Hack is the best";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// to do: styling

import React, { useState } from 'react';

const ToggleCodeBlock = ({ children }) => {
import { useState, ReactNode, FC } from 'react';

interface ToggleCodeBlockProps {
children: ReactNode;
}

const ToggleCodeBlock: FC<ToggleCodeBlockProps> = ({ children }) => {
const [isVisible, setIsVisible] = useState(false);

const toggleVisibility = () => {
setIsVisible(!isVisible);
setIsVisible((isVisible) => !isVisible);
};

return (
Expand Down

0 comments on commit 18fcd88

Please sign in to comment.