Prompt 204

Describe one thing you’re learning in class today.

We are learning about Regular Expressions. It helps you find keywords or characters that you would have to type out manually.

Can you describe the main difference between a forEach loop and a .map() loop and why you would pick one versus the other?

The returning value. The first difference between map() and forEach() is the returning value. The forEach() method returns undefined and map() returns a new array with the transformed elements.

Describe event bubbling.

When a user clicks the button the event first fires on the button itself, then bubbles up to the parent div, and then up to the ancestor div. The event would continue to bubble up through all the ancestors, until it finally reaches the document.

What is the definition of a higher-order function?

Higher order functions are functions that operate on other functions, either by taking them as arguments or by returning them. In simple words, A Higher-Order function is a function that receives a function as an argument or returns the function as output.

ES6 Template Literals offer a lot of flexibility in generating strings. Can you give an example?

Template literals provide an easy way to interpolate variables and expressions into strings. You do so by using the ${...} syntax, inside the ${} you can add anything, even expressions.

What Is an associative array in JavaScript?

Associative arrays are basically objects in JavaScript where indexes are replaced by user-defined keys. They do not have a length property like a normal array and cannot be traversed using a normal for loop.

Why should you never use new Array in JavaScript?

They are fundamentally similar. [] is pretty much shortcut for new Array(), so it is preferable. The former is called an array literal/array shorthand. The latter is an example of using the array constructor, which really does the same thing (the array constructor gets called behind the scenes for the literal). The only time you ever want to use new Array(), and not [], is when you want to have a large, empty array.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Stream XML file to PostgreSQL with NodeJS

Error Boundaries in React

Error handling image

Handling 404 Errors With Express.js

Top 10 Reasons Why JavaScript is So Popular in 2022

React JS and DRF- Creating a simple CRUD Form with Bootstrap

React Production Deployment with Netlify

React isn’t React without Babel

JSX => Babel => JavaScript

Undefined, Null and NaN

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sandra Escalante

Sandra Escalante

More from Medium

Should Social Media be categorized as an addiction?

PhET Facilitates Professional Development for Teachers around the World

A teacher works on two computers as he teaches students online.

Emotions and Empathy in Communication

Meet Matt and Shannon, Owners of Taplands!