April 13, 2023 Training

Frontend Web Development Bootcamp Course by FreeCodeCamp

(cont. from yesterday)

Built in Javascript Utility Methods

Use MDN Web Docs as reference – good hub of JS resources

Includes good info on browser compatibility – remember to consider your audience

The most important thing to learn is syntax more than anything. You can always reference operators or methodologies, but troubleshooting is a real pain if you don’t understand syntax

Callback Functions

A callback is a function passed as an argument to another function. This technique allows a function to call another function. A callback function can run after another function has finished.

JS displays responses in how they are called, not how they are written (so reverse written order)

Where callbacks really shine are in asynchronous functions, where one function has to wait for another function (like waiting for a file to load).

Use callbacks in situations where you need to reference information used in another function

Callbacks are a bit tricky to understand, so feel free to re check understanding as needed

Asynchronous programming allows you to simultaneously run different sections of code in order to decrease the time a user spends waiting for something to load

Primitives

In JS, there are six primitives: string, number, bigint, boolean, undefined, and symbol

A primitive is data that is not an object and has no methods

Primitives cannot be altered

JS Dates require an understanding of coding and time zones. They also can be written in a lot of different ways, so things can get complicated

  • Note: January is equal to 0, since JS uses indexing for months as well

You can use JS to alter inputs to match the formats you need, like replacing words, capitalizing or uncapitalizing letters, or adding/removing punctuation

There are a variety of ways to do this, so reference documentation