<metervalue="4"min="0"max="10">4 out of 10</meter> <metervalue="0.3">30%</meter>
效果如下 4 out of 10 30%
video
<video>標籤定義視頻,比如電影片段或其他視頻流。
1 2 3 4 5
<videowidth="320"height="240"controls> <sourcesrc="catMovie.mp4"type="video/mp4"> <sourcesrc="catMovie.ogg"type="video/ogg"> Your browser does not support the video tag. </video>
<blockquotecite="http://www.worldwildlife.org/who/index.html"> For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally. </blockquote>
效果如下
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
time
1 2
<p> My cat wakes up at <time>11:00</time> each day.</p> <p> I have a date with my cat on <timedatetime="2019-12-25 20:00">Christmas</time>.</p>
exportclassPeople{ constructor(name, age){ this.name = name; this.age = age; } sayHi(){ return`Hi, My name is ${this.name} and I am ${this.age} old`; } }
let patrick = new People("Patrick", 21); console.log(patrick.sayHi()); // Hi, My name is Patrick and I am 21 old
當函數被調用時,若函數引用具有上下文對象,則隱式綁定會將 this 綁定到這個上下文對象。第二個例子說的就是隱式綁定,在this的綁定規則裡,最容易出錯的就是隱式綁定,來看一段代碼,最後的那兩個函數會分別返回a和surprise,這種情況叫做隱式丟失,丟失的就是this,bar是obj.foo的一個函數別名,在調用bar的時候會丟失對obj的this引用,而直接是綁定到全局的對象中。