HTML DOM console.assert() မီးရွား
- 上一页 assert()
- 下一页 clear()
- 返回上一层 Window Console အရာ
အသုံးပြုခြင်း နှင့် လက်ခံခြင်း
console.assert() မီးရွား သတင်းကြော်ငြ� ကို ကွန်ပျူတာမှုစည်းကြောင်းသို့ ရေးပါ သော်လည်း အချက်အလက် အတိုင်းအတာ false ဖြစ်သည့် အချက်အလက်များ ကို သာမျှ ဖြစ်သည်။
အကျိုးသတ္တု
အကြောင်းကြား 1
ပထမ ပါဝင်ခြင်း false ဖြစ်သော်သာ သတင်းကြော်ငြ� ကို ကွန်ပျူတာမှုစည်းကြောင်းသို့ ရေးပါ
console.assert(document.getElementById("demo"), "You have no element with ID 'demo'");
ကိုယ်တိုင် ကိုယ်တိုင် ကျင့်လေ့လာပါ
အကြောင်းကြား 2
အော်ဒိုင်တာ တစ်ခုခု ကို ကွန်ပျူတာမှုစည်းကြောင်းသို့ ရေးပါ
var myObj = { firstname : "Bill", lastname : "Gates" }; console.assert(document.getElementById("demo"), myObj);
ကိုယ်တိုင် ကိုယ်တိုင် ကျင့်လေ့လာပါ
အကြောင်းကြား 3
အော်ဒိုင်တာ ကို ကွန်ပျူတာမှုစည်းကြောင်းသို့ ရေးပါ
var myArr = ["Orange", "Banana", "Mango", "Kiwi" ]; console.assert(document.getElementById("demo"), myArr);
ပုံစံ
console.assert(expression, message)
ပါဝင်ခြင်း အတိုင်းအတာ
ပါဝင်ခြင်း | အမျိုးအစား | ဖော်ပြ |
---|---|---|
expression | Boolean အချက်အလက် | စက်ကို လုပ်ပေးပါ၏။ အချက်အလက် တစ်ခုခု။ အချက်အလက် အတိုင်းအတာ false ဖြစ်လာခဲ့သော် သတင်းကြော်ငြာ ကို ကွန်ပျူတာမှုစည်းကြောင်းသို့ ရေးပါ၏。 |
message | 字符串或对象 | 必需。要在控制台中写入的消息或对象。 |
浏览器支持
表格中的数字注明了完全支持该方法的首个浏览器版本。
方法 | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
console.assert() | 支持 | 支持 | 28 | 支持 | 支持 |
- 上一页 assert()
- 下一页 clear()
- 返回上一层 Window Console အရာ