Skip to content

Latest commit

 

History

History

06 Functions

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

JavaScript Functions

  • Functions are one of the most vital parts of programming. Due to how important functions are, there will be a lot of things we don't cover, but remember that functions are going to be vital to any applications you write.

  • ECMAScript 6 is the most popular version of JavaScript. There are a lot of important differences between ES5 and ES6, we focus mainly on ES6 in this repo.

  • This is a function in ES6(ECMAScript 6):

const func = (a, b) => {

    let nums = a * b;

    console.log(nums); // Outputs 250

}

func(25, 10);

  • This is a function in ES5(ECMAScript 5):
function func(a, b) // Everything inside of the parenthesis defines our parameter(s)

{

    let nums = a * b;

    console.log(nums); // Outputs 250

}

func(25, 10);

  • A few things that make up a function are the parameter(s), variables, and our executed code.

  • Functions can contain if conditionals, defined variables, multiple parameters, and return statements.

  • Functions are usually the same across programming languages with minor syntax changes.