In the case that each method and variable will only be used once, which is the more correct convention?
Creating as many variables as necessary:
var x = GmailApp.getInboxUnreadCount();
var email = GmailApp.getInboxThreads (0, x);
Composing the code in one line:
var email = GmailApp.getInboxThreads (0, GmailApp.getInboxUnreadCount());
The latter, within reason. But this is largely a matter of style in the simple cases.
Meaning that if you have a function call that takes 10 arguments, and each of those arguments comes from a large function call itself, dont do this. Think of who gets your code base afterward.
“Is this line of code readable using less local variables? Or do I need to break it up to better illustrate what the line is doing?” is the question you should ask yourself. And in this case, the latter is totally readable.
In fact, I would argue the first example is less readable due to a useless local variable name
x. If instead that were named better, it might be a more viable option.This is better, but still pretty unnecessary in this very simple case.