To compile the AssemblyScript file execute
npm install
npm run asbuild
Then run a web server locally and open the index.html file.
You should compare the JavaScript code inside index.html and assembly/index.ts to understand the similarities and differences between JavaScript and AssemblyScript.