<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
<script>
var name = 'zhangsan'
var elephant = {
weight: 2,
height :2,
age : 18,
sex:'公',
color: 'gray',
ishasXiangya: '有',
eat: function eat(){
alert('eat')
},
run:function run(){
alert('run')
},
banmutou:function banmutou(){
alert('搬木头')
}
}
// 想要大象的一些体重
elephant.banmutou()
alert(elephant.color)
elephant.run()
alert(elephant['age'])
</script>
</body>
</html>
用JS 描绘一个大象对象,这个大象会搬木头
最新推荐文章于 2021-08-16 11:45:36 发布