I am Python programmer and know least about Javascript.
Can someone please explain what this function (test) means in javascript?
Thank you
function test(var1)
{
var var_str=""+Challenge;
var var_arr=var_str.split("");
var LastDig=var_arr.reverse()[0];
var minDig=var_arr.sort()[0];
answer=answer+subvar2;
return answer;
}
split
reverse
sort
, Math.pow
, etc are pre defined functions used in JavaScript. Google to learn more about these. More over, if you are good in programming, then these are just math equations.
You can do a console.log
or alert
like console.log(var_arr);
alert(var_arr);
after each line and see what result it gives.
Example fiddle
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.