change view port of svg with javascript

JavaScript
shape = document.getElementsByTagName("svg")[0];
shape.setAttribute("viewBox", "-250 -250 500 750"); 
Source

Also in JavaScript: