我看到了这个功能:
<a data-toggle="modal" data-target="#myModal1" href="">Log-in</a>
<form form id="login" action="login.php" name="login" method="POST" onsubmit="return validateForm()" align="center" role="form">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="User Name" name="username" type="text" autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="">
</div>
<!-- Change this to a button or input when using this as a form -->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<input type="Submit" name="submit" value="login" class="btn btn-primary">
</div>
</fieldset>
</form>
“(0,初始)”代表什么。
答案 0 :(得分:1)
step
首次触发0
功能,将idx
传递为initial
和reduce
(value
&# 39; s参数)为step
。 function reduce(arr, fn, initial) {
// Define the step function:
function step(idx, value) {
if (idx > arr.length - 1)
return value;
return step(idx + 1, fn(value, arr[idx], idx, arr))
}
// Call it to start the process, return the final result it returns:
return step((0, initial)
}
然后继续自称,直到完成工作为止。
如果我们将指定的函数表达式分解出来,它就更清楚了,这里没有任何用途:
@purchase_order_list = PurchaseOrderList.where(PURCHASE_ORDER: params[:ID])