From ffe6aa232915fcc80fe7492724e61191c1e83871 Mon Sep 17 00:00:00 2001 From: hyqapple <30349240+hyqapple@users.noreply.github.com> Date: Sat, 22 Jun 2019 13:09:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diary.html | 13 +++++++++++++ diary.js | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 diary.html create mode 100644 diary.js diff --git a/diary.html b/diary.html new file mode 100644 index 0000000..4c3d605 --- /dev/null +++ b/diary.html @@ -0,0 +1,13 @@ + + + + + + Diary + + + + + + + \ No newline at end of file diff --git a/diary.js b/diary.js new file mode 100644 index 0000000..6726f43 --- /dev/null +++ b/diary.js @@ -0,0 +1,54 @@ +class Daily { + constructor(name) { + this.name = name + } + wake() { + console.log(`早上,${this.name}起床了`) + } + walk() { + console.log(`${this.name}走路`) + } + work() { + console.log(`${this.name}工作`) + } + + eat(type) { + console.log(`${this.name}吃${type}饭`) + } + + exercise() { + console.log(`${this.name}在运动`) + } + + sleep() { + console.log(`晚上,${this.name}睡觉`) + } +} + +class HeadLine { + constructor(date, location, weather) { + this.date = date + this.location = location + this.weather = weather + } + headDaily() { + console.log(`${this.date} ${this.location} ${this.weather}:`) + } +} + +const DATE = '2019年6月22日' +const LOCATION = '北京' +const WEATER = '晴' + +const headToday = new HeadLine(DATE, LOCATION, WEATER) +const me = new Daily('我') + +headToday.headDaily() +me.wake() +me.eat('早') +me.walk() +me.work() +me.eat('午') +me.exercise() +me.eat('晚') +me.sleep() \ No newline at end of file