Exercise: Colored Console Output

Practice how to implement a decorator for adding colors to the console with respect to the methods.

Problem statement

Write a decorator for the console that adds the red(message), yellow(message), and green(message) methods. These methods should behave like console.log(message) except they’ll print the message in red, yellow, or green, respectively.

Coding challenge

Write your solution code in the following code widget. We’ve already added the package.json file for your ease.

Get hands-on with 1200+ tech skills courses.