The object of this exercise is to write a custom JavaScript logger. The only markup needed will be a div with an ID attribute of “result” - where the logger will append its output. Write an object that has the following characteristics: 1. It should be a function that accepts any log level defined at runtime (e.g. debug, warn, etc.) and a corresponding color to apply to the log message (e.g. gray, orange, red, etc.) as arguments. 2. This function should return a new function that takes a message as its argument and appends it to the resultant DOM element. Use this to create loggers for debug, warn, and info levels. 3. Each appended log message should be prepended by the name of its associated level and displayed in the corresponding color. Note: Do NOT hard code the log levels, colors, or resultant DOM element information in the JavaScript functions. Example Output: [debug] This is my debug message!!!! [error] Whoops we got an error! [myCustomLog] This is my custom output log message.
Check out your Company Bowl for anonymous work chats.