Konsol hatası()
Örnek
Konsola bir hata yazın:
console.error("You made a mistake");
Aşağıda daha fazla örnek.
Tanım ve Kullanım
Yöntem error()
, konsola bir hata mesajı yazar.
Konsol, test amacıyla kullanışlıdır.
Sözdizimi
console.error(message)
parametreler
Parameter | Description |
message | Required. The error message to write to the console. |
Daha fazla örnek
Hata mesajı olarak bir nesne kullanın:
const myObj = {firstname:"John", lastname:"Doe"};
console.error(myObj);
Hata mesajı olarak bir dizi kullanın:
const myArr = ["Orange", "Banana", "Mango", "Kiwi"];
console.error(myArr);
Tarayıcı Desteği
console.error()
tüm tarayıcılarda desteklenir:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 8-11 | Yes | Yes | Yes | Yes |