Image for post
Image for post

To publish a project bootstrapped with Create React App to your site on GitHub Pages, you have two options: publishing from a gh-pages branch or from master/docs.

For either method, you need to link the local repository created by Create React App to a remote on GitHub. I use GitHub Desktop (File -> Add local repository [unchecking Keep this code private] -> Publish repository), but of course you can also use the command line.

From master/docs

  1. Create a folder at your project root level (at the same level as the src and public folders) named docs. Add any file in it, like an empty .txt …


Image for post
Image for post

Here’s a brief summary of the differences between forEach(), for-in, and for-of loops to keep handy as reference.

forEach()

The forEach() prototype* method, introduced in ES5, executes a provided callback function (a function passed to another function as an argument) once for each value in Array, Map (made up of key-value pairs), Set, NodeList (an array-like object often returned by Document.querySelectorAll()), or HTMLCollection (an array-like object often returned by Document.getElementsByClassName()) objects, in ascending order.

myArray.forEach(function (value) {
// Do stuff
});

It takes a function callback as a parameter, with the current value being processed in the array as its argument. (There are also three optional arguments: the current index value, the array forEach() is being applied to, and a value to use as this [the reference Object].) …


Image for post
Image for post

There are two methods of defining a function in JavaScript: the function expression and function declaration. They’re similar, but there are a few important differences you should be aware of.

First, here are some things they have in common:

No Return Statement?
Functions don’t require an explicit return statement. Without one, a function returns undefined by default. Additionally, when a function does include a return statement, the specified return value is not returned until the function is called.

Parameters Are Optional
In both function declarations and function expressions, parameters (what’s inside the parentheses — this variable or expression is called a parameter when it’s a placeholder for something, but an argument something is being passed in during a function call [such as returnHello()]) are optional. …

About

Natalie Cardot

aspiring web developer | nataliecardot.com

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