About retun values in js

I want to consult the community about this code declaration this is my code :

static pickSubstituteTeacher(substituteTeachers) { return substituteTeachers[Math.floor(Math.random() * substituteTeachers.length)];


the developer in the codecamp wrote it this way

static pickSubstituteTeacher(substituteTeachers){
let subNum = Math.floor(Math.random() * substituteTeachers.length);
return substituteTeachers[subNum]; }

Is my way of declaring the statemen all right or should I just follow the developers way of declaring the statement?

Even though both code does the same thing, your code is more compacted, making further modification on your code more complex and harder for others to understand when they see your code.
The codecamp code style is better and I suggest you to follow it instead.
After all just follow the way in which you find more suitable for you, and take my suggestion as an advice rather than a command :slight_smile:

Mybe right some comment to explain my compact statement. hehe :smile: :smile: