I bet that on your way developing components for SPFx you already know what console.log is and how to use it…but you know that there are also other useful methods?
Following the documentation here you can find all the supported methods, some of which are:
console.warn: used to output a warning in the browser’s console.console.error: to output an error message in the browser’s console.console.debug: outputs a message in the browser’s console with a debug log level.console.info: enable the logging with an information log level.console.clear: let you clear the browser’s console.console.table: displays data as a table.console.group: used withconsole.groupEndenable the creation of a group indenting the output.- There are also different methods to enable the use of timers to track the timing of operations. To start a timer you can call
console.time, to get the current elapsed time since the creation of the timer you can useconsole.timeLog, to stop the timer you have to callconsole.timeEnd.
I think that some of the methods are pretty useful while developing, if you’re interested in knowing more you can check the documentation.
Hope that helps!

Leave a comment