Mark As Completed Discussion

One Pager Cheat Sheet

  • Making JavaScript your friend is essential for any aspiring web developers, and the guide provided will help you assess your advanced knowledge in order to land the senior developer position.
  • The output of this code will be Undefined Undefined Susan because of variable hoisting which causes function declarations and variable declarations to be moved to the top of the current scope, so name is declared but not initialized when the code first executes.
  • Javascript hoisting can make variables and functions appear declared before they are actually initialized, leading to confusion for beginners.
  • A closure is a function that has access to the variables in its parent's scope, even after the parent has returned.
  • A closure is used to keep a reference to the outer scope of outerFunc(), preserving the value of a (10) and allowing func() to log the result of a+b (30).
  • A closure allows an inner function to access variables in its outer function, even after the outer function has returned and its local variable have gone out of scope.
  • A Javascript Promise is an object serving as a proxy that allows asynchronous operations to be handled in a synchronous manner, while representing the eventual result of the operation.
  • Javascript promise is an object that acts as a proxy for asynchronous functions and can exist in Pending, Fulfilled, or Rejected states.
  • Destructuring in JavaScript allows for easy extraction of values from an object or an array and assignment of those values to variables.
  • Using destructuring syntax with the rest keyword allows you to extract an array's elements or object's properties into distinct variables in a real-world application.
  • Themap, filter, and reduce functions` enable developers to conveniently and quickly transform an array in a compact manner, without requiring explicit loops.
  • The map() method calls a callback function to add 10 to each element of the array arr, resulting in a new array, mapped_arr, with values of [11 12 13 14 15 16 17 18 19 20].
  • The map() function in Javascript loops over an array and calls a callback on each element, returning a new array.
  • The filter() method of the Array object returns a new array containing the elements for which the provided callback expression returns a truthy result.
  • Updated array is created with elements which satisfy the condition provided by callback function.
  • The reduce function applies a callback function (in this case, prev+next) to each item in the array, starting from an initial value (1), and returns a single value (55) which is the sum of every item in the array.
  • The reducer function uses a user-defined callback or reducer function to apply a return value from a previous operation to the current value of an array.
  • An Immediately Invoked Function Expression (IIFE) is a self-executing anonymous function wrapped in parentheses ().
  • An IIFE is used to execute an anonymous function immediately in order to keep variables and function declarations out of the global scope and avoid accidental interactions with other functions and variables.
  • A Immediately Invoked Function Expression (IIFE) is a self-executing anonymous function that is declared and called instantly with a grouping operator and () to indicate its invocation.