Create a Front-End App with React

Create a Front-End App with React

  • JavaScript ‘falsy’ values So which values are falsy— or evaluate to false when checked as a condition? The list of falsy values includes:

    1. 0
    2. Empty strings like "" or '’
    3. null which represent when there is no value at all
    4. undefined which represent when a declared variable lacks a value
    5. NaN, or Not a Number
  • We should also be aware of the hoisting feature in JavaScript which allows access to function declarations before they’re defined; hoisting isn’t considered good practice

  • Helper Functions?: we can also use the return value of a function inside another function. These functions being called within another function are often referred to as helper functions. debug if necessary.

  • Function Expressions: To define a function inside an expression, we can use the function keyword. In a function expression, the function name is usually omitted. A function with no name is called an anonymous function. A function expression is often stored in a variable in order to refer to it.

    Unlike function declarations, function expressions are not hoisted so they cannot be called before they are defined.

  • Concise Body Arrow Functions: function body of a single-line block does not need curly braces. Then, without the curly braces, whatever that line evaluates will be automatically returned. This is referred to as implicit return.

    • The parentheses around num have been removed, since it has a single parameter.
    • The curly braces { } have been removed since the function consists of a single-line block.
    • The return keyword has been removed since the function consists of a single-line block.
  • Higher-order function is a function that either accepts functions as parameters, returns a function, or both! Functions that get passed in as parameters and invoked, we call callback functions because they get called during the execution of the higher-order function.

  • built-in JavaScript array methods that help us iterate are called iteration methods aka iterators. Iterators are methods called on arrays to manipulate elements and return values (for example .map(), .filter(), .forEach())

  • .reduce() Method on arrays: the value of accumulator starts off as the value of the first array element; the currentValue starts as the second element. Method can also take an optional second parameter to set an initial value for accumulator (remember, the first argument is the callback function!)

  • object literals = also named object initializers

  • Prototype-based programming is a style of object-oriented programming in which behavior reuse (known as inheritance) is performed via a process of reusing existing objects that serve as prototypes. This model can also be known as prototypal, prototype-oriented, classless, or instance-based programming.

  • … we learned how to iterate through arrays using their numerical indexing, but the key-value pairs in objects aren’t ordered! JavaScript has given us alternative solution for iterating through objects with the for…in syntax. Strangely, there is no Object.forEach() method

    Objects in JavaScript can have a bunch of properties on them that are inherited from object prototypes. We can avoid this by using the hasOwnProperty() method. See more

    We can simulate Object.forEach() with Object.keys() and Array.forEach() like this. Object.keys() returns object’s own enumerable property names. Note that it is class methods and nor object instance method

  • _ underscore: Certain languages have privacy built-in for objects, but JavaScript does not have this feature. Rather, JavaScript developers follow naming conventions that signal to other developers how to interact with a property. One common convention is to place an underscore _ before the name of a property to mean that the property should not be altered.

  • Factory Functions; The convention for Factory Functions is to capitalize the name. This way you can think of it like a class but you don’t use new.

  • Some ES6 terminology: Property Value Shorthand / Destructured Assignment /

Learn Git

date 01. Jan 0001 | modified 29. Dec 2023
filename: Learn React » Course Notes » Codecademy