Using JavaScript, write a function that accepts a string and logs it.
Add the JavaScript code that iterates through each of these words using a
forloop and concatenates them into a sentence. Don't forget to add spaces!
const words = ["The", "quick", "brown", "fox"]
let sentence = ""
// Your code here
console.log(words)Using
.filter()and.forEach(), add the necessary JavaScript to print out only the 2 even numbers, such as:
2
4
const numbers = [{
content: 1,
},{
content: 2,
},{
content: 3,
},{
content: 4,
},{
content: 5,
}]Describe React components as best you can.
Write the code to create a component named
GoodbyeHome. It should have the template<h1>Goodbye, home!</h1>!
Write the code to create a component named
ShowColor. It should accept a prop calledcolorand display it in<span></span>tags.
Write the code to import a React component named
Headingusing ESM syntax. Export a React component namedArticlethat has a single prop calledcontent. Use theHeadingcomponent in the template for theArticlecomponent, as well as a<p>tag with thecontentinside it.
Write the code to export a React component named
RecordingIndicatorthat takes a boolean prop calledrecording. Ifrecordingis true, the component should display<span>Recording!</span>, otherwise it should display nothing.
Write the code to import a React component named
ListItemusing ESM syntax. Export a React component namedUnorderedListthat accepts an array calleditemsas a prop. In the template, iterate through theitemsarray and create a new instance ofListItemfor each item, passing the item into thecontentprop forListItem.
Write the code to export a React component called
SignUpForm. It should have 2 labeled inputs forusernameandpassword, both of which should be logged to the console when the form is submitted.
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 />.
function (inputString: string) {
console.log( {inputString} );
}
2.
const words = ["The", "quick", "brown", "fox"]
let sentence = ""
for each (word in words) {
sentence +== word + “ “;
}
console.log(sentence);
const evenNumbers = numbers.filter(
content === 2 || content === 4 );
evenNumbers.forEach(
console.log( content )
);
React components are tools available in the React platform that allow developers to access features and functions that would be more difficult in straight Javascript.
5.
function GoodbyeHome () [
Goodbye, home!
] 6. function ShowColor ( color ) { { color }; }