In addition to my static message (which displays just fine), how would I make the variable named 'port' green in this console.log?
console.log('Express app started on port '.green + port);
I don't see anything about adding colors to variables in the docs, and of course if I just add .green to port, it will look for the .green element of the port var which will be undefined.
Using: https://github.com/Marak/colors.js
In JavaScript, fontcolor() is a string method that is used to create the HTML <font> element and specify a font color. Because the fontcolor() method is a method of the String object, it must be invoked through a particular instance of the String class.
Variable means anything that can vary. In JavaScript, a variable stores the data value that can be changed later on. Use the reserved keyword var to declare a variable in JavaScript.
colors.js
modifies the string object -- try
port.toString().green
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With