Skip to content

Instantly share code, notes, and snippets.

@kylecoberly
Created October 12, 2022 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylecoberly/d9c3a26076ae9748f1ff85537695f0f3 to your computer and use it in GitHub Desktop.
Save kylecoberly/d9c3a26076ae9748f1ff85537695f0f3 to your computer and use it in GitHub Desktop.
1.
> Using JavaScript, write a function that accepts a string and logs it.
2.
> Add the JavaScript code that iterates through each of these words using a `for` loop and concatenates them into a sentence. Don't forget to add spaces!
```js
const words = ["The", "quick", "brown", "fox"]
let sentence = ""
// Your code here
console.log(words)
```
3.
> Using `.filter()` and `.forEach()`, add the necessary JavaScript to print out only the 2 even numbers, such as:
```
2
4
```
```js
const numbers = [{
content: 1,
},{
content: 2,
},{
content: 3,
},{
content: 4,
},{
content: 5,
}]
```
4.
> Describe React components as best you can.
5.
> Write the code to create a component named `GoodbyeHome`. It should have the template `<h1>Goodbye, home!</h1>`!
6.
> Write the code to create a component named `ShowColor`. It should accept a prop called `color` and display it in `<span></span>` tags.
7.
> Write the code to import a React component named `Heading` using ESM syntax. Export a React component named `Article` that has a single prop called `content`. Use the `Heading` component in the template for the `Article` component, as well as a `<p>` tag with the `content` inside it.
8.
> Write the code to export a React component named `RecordingIndicator` that takes a boolean prop called `recording`. If `recording` is true, the component should display `<span>Recording!</span>`, otherwise it should display nothing.
9.
> Write the code to import a React component named `ListItem` using ESM syntax. Export a React component named `UnorderedList` that accepts an array called `items` as a prop. In the template, iterate through the `items` array and create a new instance of `ListItem` for each item, passing the item into the `content` prop for `ListItem`.
10.
> Write the code to export a React component called `SignUpForm`. It should have 2 labeled inputs for `username` and `password`, both of which should be logged to the console when the form is submitted.
11.
> Using the API endpoint https://pokeapi.co/api/v2/pokemon/bulbasaur, write the code to create a component that fetches a Bulbasaur object and displays a sprite (eg. `bulbasaur.sprites.front_default`) in an `<img />`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment