Quick Index
Overview
Examples
Overview
Note that we'll use the terms
method
and
function
interchangeably here because of their similiarty in this context.
The "Big Three" of a method:
Return
- The value returned, which may be any type or may be
none
(meaning no value is returned).
Name
- name of the method
Parameters
- names of params passed to (and received by) method
The big three is a general concept -- not specific to a given programming language.
Examples
Java Method Example
With Java, just the method header tells us this method
returns
a String type, is
named
"go", and receives two
parameters
(of type "int" and "double").
So we only need a method header to know how to send a message.
public
String
go
(int
level
, double
factor
)
📋
JavaScript Method Example
Just like the Java example, a JavaScript method has
has the big three
.
In JavaScript, we can immediately see the name of the method and method params.
The method description (notes) should tell us about the return value and type and method param types.
go
(
level
,
factor
)
JavaScript Function Example
A JavaScript function closely resembles a JavaScript method. The only difference is the keyword "function" is required.
It also
has the big three
.
function
go
(
level
,
factor
)
📋
Navigation
Current Chapter Index
Examples
Coding Fundamentals (Chapter 101 - 101 - Concepts)
Chapter 101 - 101 - Concepts
The Big Three
> CHAP101
Chapter
Examples
Top
Search Site
TOC