<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title-hellovuejs</title>
<style>
</style>
</head>
<body>
<script>
const name = 'why';
const age = 18;
const height = 1.88;
//ES5写法
// const obj = {
// name: name,
// age: age,
// height: height
// }
//增强写法
const obj = {
name,
age,
height
}
console.log(obj);
//2.函数的增强写法
//ES5
// const obj2 = {
// run:function(){
// },
// eat:function(){
// }
// }
//ES6 增强写法
const obj2 = {
run(){
},
eat(){
}
}
</script>
</body>