Here's the code on Glowscript: https://www.glowscript.org/#/user/Ian_Page/folder/Public/program/Vectors
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.