CONSOLE in JavaScript | code debugging in Console | console output #kody_az
Dərs haqqında
JavaScript-də console obyekti, proqramınızı işlədərkən məlumatları yoxlamaq və səhvləri tapmaq üçün çox faydalı bir vasitədir. Əksər müasir brauzerlərdə (həmçinin Node.js-də) quraşdırılmış olan bu obyekt, məlumat, səhv, xəbərdarlıq və hətta zaman ölçmə kimi funksiyaları yerinə yetirən müxtəlif metodlar təqdim edir.
console.log()
Konsola ümumi məlumat mesajı çıxarır.
console.warn()
Konsola xəbərdarlıq mesajı çıxarır. Bu, kritik olmayan məsələləri diqqətə çatdırmaq üçün istifadə olunur.
console.info()
Konsola məlumat mesajı çıxarır. Bir çox brauzerdə console.log() ilə oxşar işləyir.
console.debug()
Konsola debugging (izləmə) məlumatları çıxarır. Brauzerin konsol ayarlarına görə bu mesajlar default olaraq gizlədilə bilər.
console.table()
Konsolda cədvəl formatında məlumatları göstərir.
console.group() və console.groupEnd()
Əlaqəli mesajları yığılan (collapse) qrup şəklində təşkil edir.
console.time() və console.timeEnd()
Bir kod bloku işləmək üçün nə qədər vaxt sərf edildiyini ölçür.
console.count()
Hər dəfə eyni yazı çağırıldıqda, həmin yazı üçün say artırılır və konsolda etiketlə birlikdə cari say göstərilir.
console.assert()
Əgər şərt yalnışdırsa, konsola səhv mesajı çıxarır. Bu, kodunuzdakı fərziyyələri test etmək üçün faydalıdır.
console.clear()
Konsolu təmizləyir.
=======
The console object in JavaScript is a very useful tool for debugging and logging information. It’s built into most modern browsers (and Node.js) and provides several methods to help you output information, errors, warnings, and even timing details.
console.log()
Outputs a general message to the console.
console.error()
Outputs an error message. In many browsers, this message appears in red to distinguish it from normal log messages.
console.warn()
Outputs a warning message. This is often used for non-critical issues that you still want to draw attention to.
console.info()
Outputs an informational message. It is very similar to console.log() in many browsers.
console.debug()
Outputs a debug-level message. Depending on your browser’s console settings, these messages might be hidden by default.
console.count()
Every time the method is called with that label, the count increments by one and logs the label along with the count.
console.table()
Displays tabular data as a table in the console.
console.group() and console.groupEnd()
Organizes related messages into a collapsible group.
console.time() and console.timeEnd()
Measures the time taken by a block of code to execute.
console.assert()
Writes an error message if the assertion is false. It can be useful for testing assumptions in your code.
console.clear()
Clears the console.
#kody_az #kodyaz #js #javascript #nodejs #es6 #viral #viralcode #nodejs #viralvideo #random #code #coder #azerbaycan #azerbaijan #baku #baki #programming #programmer #codes #hazırlıq #hazirliq #kurs #kurslar #course #courses #online #onlinecourses #test #quiz