GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • JavaScript
  • Calling

This view

  • Original page
  • New address

GeezerVison is showing arcade.makecode.com — Call a function

Skip to main content
About FAQ Projects GitHub
Reference
sprites controller game music scene info images
Blocks
On Start
Loops
repeat for while for of
Logic
if Boolean
Variables
assign change var var
Math JavaScript blocks Custom blocks
Python
Calling Sequencing Variables Operators Statements Functions Classes
JavaScript
Calling Sequencing Variables Operators Statements Functions Types Classes Interfaces Generics
Types
Number String Boolean Array Function Image Sprite
Blocks Gallery
Miscellaneous
About Support Translate Sharing projects Multiplayer Offline support Save Sign In Cloud Sync VS Code Asset packs
Hardware
Errors Adding New Board Raspberry Pi Makey Makey Shoebox Controller Dev Debug connector
Developers
Command Line Interface Visual Studio Code support Blocks Embed Art, images, colors Sounds
Lessons
Cherry Pickr Barrel Dodger Dance Party BlockOut
Courses
CS Intro 1 CS Intro 2 CS Intro 3

Call a function

The simplest way to get started in JavaScript is to call one of the built-in JavaScript functions. Just like how Blocks are organized into categories/drawers, the functions are organized by namespaces, with names corresponding to the drawer names.

Math.abs(-1)

Functions in a namespace

If you want to see all functions available in the Math namespace, simply type Math followed by . and a list of all the functions will appear.

Left and right parentheses, please!

Whenever you want to call a function, you give the name of the function followed by ( and ending with ). In between the left and right parentheses go the function arguments:

Math.min(1, 2)

It's a syntax error to have a left parenthesis without the "closing" right parenthesis:

Math.min(

If a function has zero arguments, you still need the parentheses in order to call the function.

Any results for me?

Many functions return a result for you to use later in your program. This might be a number, a string, or another type of data.

let greater = Math.max(5, 10)

Edit this page on GitHub
Edit template of this page on GitHub
Edit template of this page on GitHub

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.