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