Need help converting c++ code to javascript

Printable View