一點一點比完美更好不是嗎?
雙重等於和嚴格等於。
console.log(10 == 10); // True console.log(10 == "10"); // True console.log(10 === 10); // True console.log(10 === "10"); // False
記得開關。
var hoge; switch(hoge) { case 1: console.log("hoge"); // If hoge == 1, output will be "hoge" and "hogehoge" case 2: console.log("hogehoge"); // If hoge == 2, output will be "hogehoge" break; case 3: console.log("fuga"); // If hoge == 3, output will be "fuga" break; }
學習對象。
var exampleObject = { "hoge": "ほげ", "hogehoge": "ほげほげ", "fuga": "ふが", } /* Dictionary in Python might be similar data structure? We can add a content with operation like below*/ exampleObject.fugafuga = "ふがふが"; // or... exampleObject["fugafuga"] = "ふがふが"; // If additional element is same as last element, additional one is ignored. // (It's just my guess. I've googled but I couldn't find information about it)
以上是DayMG)DaysOfJavaScript的詳細內容。更多資訊請關注PHP中文網其他相關文章!