What does x.length do in JavaScript?
I am doing this JavaScript math question where it asks me his math question. I do the math, type the answer in the box, and sumbit it. If i am ri开发者_开发百科ght I move on but I got lost at x.length. I don't know what that means. Here is a example of the problem:
var a= 5+6*4
var b= a / 9
Function (x)
(
if (x.length == b)
This is what he is after... most likely..
var foo = 5 + 6 * 7
var bar = foo % 8
var moo = bar * 2
var rar = moo / 3
function check(x)
{
if (x.length == moo)
{
alert("win!");
window.location += "?lvl_password="+x;
} else {
alert("fail D:");
}
}
It's a mission in hackthissite.org to break a javascript password login
I agree with Robusto: this is a broken code. However, x.length can mean one of three things:
- the number of items in an array;
- the number of characters in a String;
- the number of digits in an integer;
and more.
精彩评论