From 274bdd9b05e72e90c9e8bb8bdd1de283402dd586 Mon Sep 17 00:00:00 2001 From: guoxinming Date: Fri, 21 Jun 2019 17:12:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=97=A5=E5=BF=97=20?= =?UTF-8?q?=E2=80=94=20=E9=83=AD=E8=8A=AF=E9=93=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diary.js | 37 +++++++++++++++++++++++++++++++++++++ index.html | 10 ++++++++++ 2 files changed, 47 insertions(+) create mode 100644 diary.js create mode 100644 index.html diff --git a/diary.js b/diary.js new file mode 100644 index 0000000..2117ce5 --- /dev/null +++ b/diary.js @@ -0,0 +1,37 @@ +/** + * 变量:小驼峰 + * 常量:大写 + * 对象类:大驼峰 + * 函数:小驼峰 + * 布尔值:is,has,can开头 + * 私有属性:_下划线开头 + */ +class MyStory { + constructor() { + this.years = 0; + this.interests = []; + } + + gotoSchool(years, interests){ + var DATEOFSCHOLL = '1997-09'; + + this.years = years; + this.interests = interests; + this._printLog(`${DATEOFSCHOLL},我开始上学,经历${this.years}年学生时代,我的兴趣爱好是${this.interests.join('、')}!`) + } + + gotoWork(years) { + var DATEOFWORK = '2017-04'; + + this.years = years; + this._printLog(`${DATEOFWORK},我开始工作,工作了${this.years}年。I believe that future will be better and better!`) + } + + _printLog(str) { + console.log(`${str}`) + } +} + +var myStory = new MyStory(); +myStory.gotoSchool(20, ['绘画','手工制作']); +myStory.gotoWork(2); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..2a2fea2 --- /dev/null +++ b/index.html @@ -0,0 +1,10 @@ + + + + + 我的日记 + + + + + \ No newline at end of file