Pythagoras tree: Difference between revisions

m
→‎{{trans|Rust}}: cosmetics comments
(→‎{{trans|Rust}}: refactoring)
m (→‎{{trans|Rust}}: cosmetics comments)
Line 986:
const svg = doc.replace('<svg ', `<svg viewBox="${[x, y, -x - x, -y]}" `);
 
if (globalThis.global) { // if the script is run from node.js - save the svg to a file
require('node:fs').writeFileSync('Pythagor_tree.svg', svg);
} else { // if the script is run from the browser console or from the <script> tag of thean html document
// - display the svg in the browser window
document.body.innerHTML = svg, '';
}</syntaxhighlight>
106

edits