Quick Fix Refactoring
It's important to note what you target with your Quick Fix, as it determines the available options.
Inlining Variables
If you target randomPercentage
, you can select an "Inline variable" option.
This would remove the variable and inline its value into the console.log
:
const
Transcript
00:00 Let's take a look at the quick fixes menu again. Here we have a func here and this function, it has a random percentage, which is basically taking in like it's just sort of calling math.random here and it's then making it to fix them. It's sort of creating like a random percentage, which is nice. And then it's logging that percentage.
00:20 What we want to do is we want to basically take the thing that's being produced by random percentage, this little piece of logic here, and just refactor it into its own function. You might take a look and you might just sort of like have a little poke around with the stuff that's like available in your quick fix.
00:39 And you can see that maybe you might end up with something that works. So why don't you try some of these quick fix menu items like extract to in a function in arrow function, for instance, and just try out what's available and then we'll see if you found the right solution afterwards. Good luck.