Function declaration vs call

A function declaration is where we tell the computer what our function will do. For example:

var sayHello = function() {
  console.log("Hello there!")

In order for this function to activate we must tell it to do so. In other words we must call the function. Example:

//this is the declaration
var sayHello = function() {
  console.log("Hello there!")

if (person.isFriend) {
    sayHello(); //here is the function call

Function declaration vs call courses

Exercises: Classes

Classes generate objects while your program is running. They can also give different types of objects internal methods. For example a Car class objectmight have a method called Drive(). It's very useful to think of your data as classes and objects.

Helicopter Game

Create a game where the player pilots a helicopter with the mouse and collects coins while avoiding obstacles

Function declaration vs call lessons

Write a function that creates an Object

Create a function which in turn creates a new Object when it's called

Helicopter Game: Movement and Coins

In the first part of this course we will be making a simplified version of the game which allows the player to move and to collect coins

Related Links

No links found
About Function declaration vs call

Functions must be told what they do (declared) and when to do it (called)


Functions Declaration vs Call