Object Fundamentals
Common JavaScript Types
| Name | Value |
|---|---|
| Undefined | undefined |
| Null | null |
| Boolean | true |
| String | "foo" |
| Number | 3.14159 |
| Object | { bar: "baz" } |
| Function | function qux() {...} |
| Array | [ "hoge", 42 ] |
| RegExp | /piyo/ |
Primitive Types
| Name | Value |
|---|---|
| Undefined | undefined |
| Null | null |
| Boolean | true |
| String | "foo" |
| Number | 3.14159 |
| Object | { bar: "baz" } |
Special Objects
| Name | Value |
|---|---|
| Function | function qux() {...} |
| Array | [ "hoge", 42 ] |
| RegExp | /piyo/ |
Objects
An Object is a set of name/value pairs, also known as key/value pairs.
- A key name must be in the form of a string.
- Each string can be associated with any type (primitive type or object type)
- Primitive types are passed by their value.
- Object types are passed by their reference.
Functions
Functions are just regular kinds of objects. When a function is defined, it has three properties already defined:
name- The name of the functionlength- The number of argumentsprototype- TBD
Methods
When you put a function inside of an object it’s typically called a method.
Post written on June 17, 2015
Post written on 2015-06-17 00:00:00 -0700
Post written on 2015-06-17 00:00:00 -0700