Objects Lesson
Terms | Operators | Language | Objects | Rules
Objects - General
| Syntax | Usage | Notes |
|---|---|---|
. |
object.property or object.method() |
Javascript supplies some native objects like Array and Math and Date. These are objects that have pre-defined properties and methods. For instance var count = myArray.length; |
new |
new objectname(); | This is the operator used to make a new instance of a pre-defined object such as Array or Date. |
this |
function(this) or this.attribute |
"this" is the keyword that means "this object" ex: |
Javascript Native Objects
String Object: Some Common methods
- stringname.toLowerCase(); stringname.toUpperCase()
- stringname.fontcolor(), stringname.fontsize()
- stringname.substr() to get a part of the string
- stringname.indexOf(str) to get the position of a character or -1 if it doesn't exist in the string
Date Object: Some Common methods
- Date()
- getDay(), getDate(), getMonth(), getYear(), getHours(), getMinutes()
- datename.toString() sets date as a string
Math Object: Some Common methods
- round(x), random(), min(x,y), max(x,y)
- sin(x), cos(x), sqrt(x)
Terms | Operators | Language | Objects | Rules
