小编Mar*_*lin的帖子

如何在JavaScript中添加工作日?

var businessDays = 10; // this will come from a form
var counter = 0;  // I have a counter
var safety = 0;  // I have a safety variable
var ship = today = new Date();  // I have the current date and an initialized shipping variable but the buy date will come from a form

while( ++safety <30 ){
ship.setDate( safety );  // add a number of days
switch( ship.getDay() ){

    case 0: // Sunday
    case 6: // …
Run Code Online (Sandbox Code Playgroud)

javascript

6
推荐指数
2
解决办法
1万
查看次数

为什么console.log不输出chrome?

最近我读了一个关于"console.log做什么"的查询,我读了一个答案,尝试使用它,发现尽管答案说它在谷歌浏览器输出到控制台,我只是尝试了它,我没有输出.

我确实试过这段代码:

function put(p){
if ( window.console && window.console.log ) {
        console.log(p); // console is available
    }else{
        alert(p);
    }
}
Run Code Online (Sandbox Code Playgroud)

但是......我既没有控制台输出也没有警报,而且.log是一个数学属性,是什么赋予了它?

google-chrome console.log

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

console.log ×1

google-chrome ×1

javascript ×1