Object.freeze(),这会阻止修改现有的属性,

規劃一個功能做的話=>1.規劃哪種事件 2.觸發事件3.執行function

// JavaScript parseInt() 函数 http://www.w3school.com.cn/jsref/jsref_parseInt.asp

// Math.pow(x,y) = 返回 x^y 之值(x的y次方)

// toFixed(#) = 將#位之後的數字四捨五入

// 為HTML空白屬性; 為全形空白

//indexOf 詢問第一筆相符資料的索引

ex1
var colors=['abc','eqweq','pink']
console.log(colors.indexOf('pink')) 
=>2

ex2
color.splice(colors.indexOf('red'));
console.log(colors);

date日期

            var d = new Date();
            return d.getSeconds()

<input type="submit"> 元素被視為 form元素的提交按鈕(submit button),點選的話就能把表單提交到伺服器,並同時對頁面執行重新整理 reload()。

因此在我們點擊<input type="submit"> 元素時,會觸發頁面 reload() 這個動作,因此在觸發的函式當中,我們必須加上 event.preventDefault() 這個方法。

event.preventDefault() 這個方法可以將允許被取消的事件,取消該事件的預設行為,但不會影響事件的傳遞,事件仍會繼續傳遞。

使用freeze會使得變數內的值被凍結住

results matching ""

    No results matching ""