Literal Notations
A little something from my forthcoming book "Object-Oriented JavaScript" I thought would be nice to share.
name | literal | constructor | example |
---|---|---|---|
object | {} |
new Object() |
{prop: 1} |
array | [] |
new Array() |
[1,2,3,'test'] |
regular expression |
/pattern/modifiers |
new RegExp('pattern', 'modifiers') |
/java.*/img |
Tags: book, literal notation, oojs