From 4aeac4c2e9cf8bcbc4a56f70a3b050fa0370811e Mon Sep 17 00:00:00 2001 From: yuyuling Date: Sat, 22 Jun 2019 12:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E8=AE=B0-=E4=BD=99=E7=8E=89=E7=8E=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- one-day.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 one-day.js diff --git a/one-day.js b/one-day.js new file mode 100644 index 0000000..adb14ec --- /dev/null +++ b/one-day.js @@ -0,0 +1,57 @@ +/** + * 正常工作的一天 + * @class OneDay + * @constructor + * @param{String} name + * @param{Date} date + */ +class OneDay { + constructor(name, date) { + this.name = name; + this.date = date; + } + + // 起床 + wakeUp() { + console.log('起床啦,开始一天的工作'); + } + + // 吃饭 + eat(name) { + console.log(`去吃${name}啦`); + } + + // 通勤 + commute(from, to) { + console.log(`从${from}到${to}啦`); + } + + // 开始工作啦 + work(workName) { + console.log(`开始做${work}工作啦`); + } + + // 业余生活 + doLeisureActivity(activity) { + console.log(`开始${activity}`); + } + + // 睡觉啦 + sleep() { + console.log('睡觉啦'); + } +} + +const DATE = new Date(2019, 6, 22); + +let yyl = new OneDay('yyl', DATE); + +yyl.wakeUp(); +yyl.eat('早饭'); +yyl.commute('家', '公司'); +yyl.addWork('work 1'); +yyl.eat('午饭'); +yyl.work('work 2'); +yyl.commute('公司', '家'); +yyl.doLeisureActivity('打羽毛球'); +yyl.sleep();