iT邦幫忙

0

javascript 分割

  • 分享至 

  • twitterImage

假設

var Info = {
    test1:1,
    test2:2,
    h:5,
    m:20
}

執行後顯示為

Info={test1:1,test2:2,h:5,m:20}

我該如何只顯示(h*1000)+m的結果?

Luis-Chen iT邦新手 4 級 ‧ 2019-03-14 08:42:57 檢舉
() => {
return Info.h * 1000 + Info.m
}
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

2
froce
iT邦大師 1 級 ‧ 2019-03-12 16:07:32
最佳解答
var Info = {
    test1:1,
    test2:2,
    h:5,
    m:20,
    score: function(){return (this.h*1000)+ this.m}
}

console.log(Info.score())

我要發表回答

立即登入回答