Nonetheless, these features help you overcome some of the most common issues we encounter while using this language.
- It makes an object or array immutable
console.time and console.timeEnd
- console.time starts a timer and console.timeEnd ends it. The timer created should have content in the middle of them, so these functions will check how much time it takes for the code in the middle to execute.
console.error && console.warn
- When an error occurs you will notice a red-looking error log in the console, you can make your own error log with this function. When a warning appears you will notice a yellow-looking log in the console,
- you can make your own warning log with this function.
- The console.assert() method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.
- Prints an array or object in a tabular format
Styling Console Logs
- The ‘in’ keyword checks whether a property exists in an array or object
- The delete keyword deletes a property from an array or object
Have any doubts, leave a comment. I shall make sure to clarify them.
By Darsh Adak