Confusion with javascript

try using this way of solving algorithms:

research on google stuff

and if you are really stuck, ask for help on the forum