Prototype - succ() 方法



此方法返回當前數字的後繼項,格式為 current + 1。用於使數字與 ObjectRange 相容。

語法

number.succ();

返回值

舍入當前數字的後繼項。

示例

<html>
   <head>
      <title>Prototype examples</title>
      <script type = "text/javascript" src = "/javascript/prototype.js"></script>
      
      <script>
         function showResult() {
            alert( "(5).succ() : " + (5).succ() );
            alert( "(-5).succ()  : " + (-5).succ() );
         }
      </script>
   </head>

   <body>
      <p>Click the button to see the result.</p>
      <br />
      <br />
      <input type = "button" value = "Result" onclick = "showResult();"/>
   </body>
</html>

輸出

prototype_number_processing.htm
廣告