html JS.Object.GameDesignwObjects.ex3

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html JS.Object.GameDesignwObjects.ex3相关的知识,希望对你有一定的参考价值。

var darkVador = {
  race: 'human',
  job: 'villain',
  talk: function() {
    return 'come to the dark side, Luke!' + this.breathe();
  },
  describeYourself: function() {
    return "I'm a " + this.race + " and I'm a " + this.job + " in a series of movies!" + this.breathe();
  },
  breathe() {
    return ".....shhhhhhhhh.....";
  }
}

function dvSpeak() {
 document.body.innerHTML += '<p>Dark Vador describes himself: ' + darkVador.describeYourself(); + '</p>';  document.body.innerHTML += '<p>Dark Vador says: ' + darkVador.talk(); + '</p>';
}
JS.Object.GameDesignwObjects.ex3
--------------------------------


A [Pen](https://codepen.io/Onlyforbopi/pen/dqxNyq) by [Pan Doul](https://codepen.io/Onlyforbopi) on [CodePen](https://codepen.io).

[License](https://codepen.io/Onlyforbopi/pen/dqxNyq/license).

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>JavaScript OOP: methods</title>
  </head>
  <body>
    <button onclick='dvSpeak();'>Make Dark Vador speak!</button>
    </body>
</html>

以上是关于html JS.Object.GameDesignwObjects.ex3的主要内容,如果未能解决你的问题,请参考以下文章

html Html模板/ Html Boilerplate |标签HTML

html里怎么引用一个html的头部

html5与传统html区别

html4和html5的区别

HTML元素

head标签怎么给多个html引用