Skip to content

leonnelkakpo/js-paradigms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Programming paradigms

JavaScript Paradigms

JS is:

  • Functional*
  • OOP
  • ...

What is functionnal programming ?

Code style, Mindset

  • Computation as the evaluation of mathematical functions
  • Avoid changing-state and mutable data
  • ...

Principles

  • Pure function

    • Same input => Same output

    • No side effect

    • This is not a pure function

      var absolute_zero = -273.15;
      
      const celsiusToKelvin = (temp) => {
          return temp - absolute_zero;
      };
    • This is cool

      const celsiusToKelvin = (temp, absolute_zero) => {
          return temp - absolute_zero;
      };
      
      // OR
      
      const celsiusToKelvin = (temp) => {
          return temp + 273.15;
      };
  • Immutability

  • High order function

Resources

About

JavaScriot paradigms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published