//----------------------js代码-------------------
var user = {
name:'tom',
say:function(){
console.log("hello");
}
}
//----------------------html页面代码-------------------
<script type="text/javascript" >
user.age = 25;//给user添加属性
user.sayHello = function(){//给user添加方法
console.log("hello other");
}
console.log(user['name']);
console.log(user['age']);
console.log(user['sayHello']);
</script>