How to simplify writing to a variable?

Set variables values of the viewBox.
var width = 450;
var height = width;
var offset = 15;
var viewBox = '-' + offset + ' -' + offset + '' +
 (width + offset*2) + '' + (height + offset*2); // '-15 -15 480 480'

Is it possible to simplify the entry variable viewBox (note: without the use of template strings)?
June 3rd 19 at 19:34
2 answers
June 3rd 19 at 19:36
Solution
Much easier unlikely.
I would write this:

var viewBox = [ -offset, -offset, width + 2 * offset, height + 2 * offset ].join(' ');
Thanks for the reply, he was inclined to use such entry. - ben_Quitzon3 commented on June 3rd 19 at 19:39
Method purely for convenience of the programmer edits any masks or parameters. No more. - jerrold_Hickle commented on June 3rd 19 at 19:42
June 3rd 19 at 19:38
Solution
Not quite clear what it means to simplify. Like and so all is quite simple.
Well it is possible so to write:
var viewBox = [
-offset,
-offset,
 width + offset*2,
 height + offset*2
].join(' ');
Thanks, I think, more readable. - ben_Quitzon3 commented on June 3rd 19 at 19:41

Find more questions by tags JavaScript