Home >Web Front-end >JS Tutorial >Javascript directly defines object instances [_javascript tips
From: JavaEye.com
JavaScript can directly define object instances without defining object categories:
var person = {
name : "",
age : 0,
toString: function() {
document.writeln("[name]:" this.name "
" "[age]:" this.age);
}
}
Full HTML example: