If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Course: Unlisted resources area > Unit 2

Lesson 1: ProcessingJS documentation

Defining a function

To define a new function in JavaScript, follow this template, specifying the name, arguments taken (if any), code to execute, and return value (if any).
var yourFuncName = function(arg1, arg2) {
    // your function code here
   return returnValue;
};

Want to join the conversation?

No posts yet.