Functional Programming&& - 401-advanced-javascript-Mai/amman-javascript-401d1 GitHub Wiki

Functional Programming

programming with knowing the difference between pure code (give the same result each time ) and impure code( running two-times different from once"depends on that side effect").


how to distinguishes and identify functional programming and procedural and object-oriented ??

  • Procedural: sequential steps.
  • object-oriented: communicating object.
  • functional programming>>> based in pure functions >> give the same result with same input "easily reused"

Higher-order functions: it functions operate other functions (can be token as input and output)(ex. map, filter ). note: it's a tent of functional programming.


Objects and Inheritance

  • prototype-based inheritance: methods or properties related to object allow to use and available in object and descendants.
  • class inheritance: still use prototype-based inheritance but much easier and clear.

** Errors**

  • important in debugging.
  • Writing Good Error Messages >> ( to be great it need: timestamp, message problem, the message of cause, format, describe level).
  • Handling Thrown Errors: way to force use an improper function.
  • sooner fail sooner fined bugs.
  • away to complete running in javascript is try {} catch (error) {}.

Error Cheat Sheet " like type error, syntax error,.....) system Error Cheat Sheet "like EACCESS, EADDRINUSE ,ECONNREFUSED,......)


video: context " the content of this "