It is possible to do a lot of operations in one long statement. However, this makes the scripts hard to read.
Compare for example the following code, which randomly picks one of the codes in an array codes,
selectedCode = codes[Math.floor(Math.random()*codes.length));with this code:
randomNumber = Math.random()*codes.length;
randomIndex = Math.floor(randomNumber);
selectedCode = codes[randomIndex];
The first code will be a bit more efficient than the latter, because you do not have to store values in the variables randomNumber and randomIndex. However, because it will be much easier to understand what happens in the last one, that approach is recommended.
To increase readability, use temporary variables and do the calculations step by step.