就是true或者false了
1表示true -1表示false

解决方案 »

  1.   

    就是true或者false了
    1表示true -1表示false
      

  2.   

    偶觉得能改别人的东西为自己的就可以了.自己写一开始很慢的,偶觉得没有必要.实践的多了自然就会了.多实践.
    比如上面的你先要查Match.round是什么,match.random()是什么,至于return是返回值.引用它的地方需要该方法返回的值,返回1去处理什么,返回-1又去处理什么.....
      

  3.   

    Math.round(n)
    是返回四舍五入的n的值
    match.random()
    是返回0,1之间的随机数字
    ---------------------random
    Returns a pseudo-random number between 0 and 1. The random number generator is seeded from the current time, as in Java.
    方法源 Math 
    静态 
    实现版本 Navigator 2.0, LiveWire 1.0: Unix only
    Navigator 3.0, LiveWire 1.0: all platforms 语法
    random() 
    参数
    无。描述
    Because random is a static method of Math, you always use it as Math.random(), rather than as a method of a Math object you created.示例
    //Returns a random number between 0 and 1
    function getRandom() {
       return Math.random()

    round
    Returns the value of a number rounded to the nearest integer.
    方法源 Math 
    静态 
    实现版本 Navigator 2.0, LiveWire 1.0 语法
    round(x) 
    参数
    x A number 描述
    If the fractional portion of number is .5 or greater, the argument is rounded to the next highest integer. If the fractional portion of number is less than .5, the argument is rounded to the next lowest integer.
    Because round is a static method of Math, you always use it as Math.round(), rather than as a method of a Math object you created.
    示例
    //Displays the value 20
    document.write("The rounded value is " + Math.round(20.49)) //Displays the value 21
    document.write("<P>The rounded value is " + Math.round(20.5)) //Displays the value -20
    document.write("<P>The rounded value is " + Math.round(-20.5)) //Displays the value -21
    document.write("<P>The rounded value is " + Math.round(-20.51)) In server-side JavaScript, you can display the same output by calling the write function instead of using document.write.
    -----------------------------
    偶觉得实践最好,我买的JS书籍不多,网上的参考手册很不错的.javascript参考手册,DHTML手册等等.可以这里看别人的问题嘛,问题你会的的话解决一下,不会的话也试式,别人解决了,你看看不就提高了?
      

  4.   

    谢谢两位大虾,我想知道为什么是返回-1,而不是返回0。我试过将-1改为0,显示结果就会改变了,按理说,0也是代表false,那为什么不用0,而用-1呢?望能解答!!!!
      

  5.   

    if(0)  条件为假
    if(-1)  if (1)  条件为真