30 Days Of JavaScript

Day 5: Functions Part 1

Lesson 2: No Input, No Return

We are going to have a series of short lessons today, slowly building up a function from something very simple to something quite complicated.

The simplest form of a function takes no inputs and returns nothing. Here is such a function:

We declare the function with

  1. The function keyword

  2. aFunctionName with that funny camel case style.

  3. Adding () after the name is where inputs will go (next lesson)

  4. The code between the { } is the code that is run when we call our function with ...

  5. aFunctionName() to "call it" (or in technical terms: invoke it)

Try changing the name of the function, try calling it more than once by copying where we call it.

Outline

Go Pro?

If you upgraded to pro, sign in here

  • About
  • Blog
  • Privacy
Looking to email me? You can get me on my first name at allthecode.co