function decimalToHex(d, padding) {
var hex = Number(d).toString(16);
/*I dont understand this part: does this mean if padding gets a value = "undefined". It'd be equal to "justchecking" in this case.
What is a value of "undefined" then? is it really necessary this if-statement? */
padding = typeof (padding) === "undefined" || padding === null ? padding = "justchecking" : padding;
while (hex.length < padding) {
hex = "0" + hex;
}
return hex;
}
感謝你的解釋...不明白這個JS
這屬於代碼審查 – Neal 2011-05-09 17:25:08
@Neal你是什麼意思? – YoniGeek 2011-05-09 18:30:34