JavaScript Functions

JavaScript Functions

7th Grade · Computer Science · 45 min

Lesson Preview

Learning Objective

I can write a JavaScript function to perform a specific task.

  • 1

    A JavaScript function is a sub program that performs a specific task, such as calculate, print, or process data.

  • 2

    To declare a function, you start with the function keyword, then the function name, parentheses, and curly brackets containing the code to be executed.

  • 3

    A function can only return one thing, but you can return an object containing multiple values if needed.