JS-FUNCTIONS

TWO TYPES OF FUNCTIONS



Function Declaration

Function Declaration - is a regular function and represented by"var"

Function Expression

Function Expression - Is represented by"var"

EXPRESSION VS STATEMENT



Expression

  • Always produce immediate value
  • Function Calls
  • If Statements

Statement

  • Always produce action
  • No immediate results
  • Function declaration

BASIC FUNCTION

⤥ Basic function with return parameter ⤦

SOLVING FUNCTION WITH FUNCTION

⤥ Use one function to solve another ⤦

FUNCTION EXPRESSIONS

Function Expression with Switch

In a switch I can use return instead of break.
It will work the same way and return the value.