'WebStorm: how to put highlighted text into console.log with prefix

Since I use console.log() every day multiple times, I would like to make this a bit more efficient.

So if I have a variable:

const testVariable = 0;

and I want to log this, I usually create something like this:

console.log("testVariable: ", testvariable); 

which is especially helpful (compared to just using console.log(testVariable) when I am logging a lot of values). So I always know which value belongs to which variable.

So my question is:

Is there an easy way in WebStorm IDE (like auto complete, code replacement, code wrapping, whatever) that I can use to highlight the variable testVariable and then do a shortcut or click somewhere and it creates this:

console.log("testVariable: ", testvariable);

I am very thankful for any advice.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source