Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么是/1/quot;用javascript是什么意思?_Javascript_String_Date - Fatal编程技术网

什么是/1/quot;用javascript是什么意思?

什么是/1/quot;用javascript是什么意思?,javascript,string,date,Javascript,String,Date,我在网上读一段代码。 我在javascript代码中看到了这一行。 在以下代码语句中“/1/”和“/0/”用于什么 var firstDate = new Date(String(monthNum) + "/1/" + String(yearNum)); var lastDate = new Date(String(monthNum + 1) + "/0/" + String(yearNum)); “/1/”和“/0/”都是字符串文本 您正在将这两个字符串与月和年字符串(通过调

我在网上读一段代码。 我在javascript代码中看到了这一行。 在以下代码语句中“/1/”和“/0/”用于什么

    var firstDate = new Date(String(monthNum) + "/1/" + String(yearNum));
    var lastDate = new Date(String(monthNum + 1) + "/0/" + String(yearNum));
“/1/”
“/0/”
都是字符串文本


您正在将这两个字符串与
字符串(通过调用
字符串()
形成,尽管我认为它们不是必需的)连接起来,以构造特定的日期字符串。

您是否尝试打印
字符串(月)+“/1/”+字符串(月)
?它只是一个字符串文字,用作更大字符串的构建块。这里是一个字符串,它们连接了一个日期,输出应该类似于
新日期(“月数/1/年数”)
,所以我将您的代表改为10k。。。恭喜:)@ZaheerAhmed:看来是这样。非常感谢你!