FED28. 返回星期数
描述
请补全JavaScript函数,要求以字符串的形式返回数字参数所对应的星期。HTML/CSS/JavaScript 解法, 执行用时: 1679ms, 内存消耗: 77772KB, 提交时间: 2022-02-09
{"css":"","js":"function _getday(value) {\n // 补全代码\n let arr = ['天', '一', '二', '三', '四', '五', '六'] ;\n return `星期${arr[value % 7]}`\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1680ms, 内存消耗: 77812KB, 提交时间: 2022-02-09
{"css":"","js":"function _getday(value) {\n // 补全代码\n let text =null;\n switch (value){\n case 1: \n return '星期一';\n break;\n case 2: \n return '星期二';\n break;\n case 3: \n return '星期三';\n break;\n case 4: \n return '星期四';\n break;\n case 5: \n return '星期五';\n break;\n case 6: \n return '星期六';\n break;\n case 7: \n return '星期天';\n break;\n default:\n return '输入错误得数字'\n } \n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1683ms, 内存消耗: 77804KB, 提交时间: 2022-02-09
{"css":"","js":"function _getday(value) {\n // 补全代码\n switch(value) {\n case 1:\n return '星期一';\n break;\n case 2:\n return '星期二';\n break;\n case 3:\n return '星期三';\n break;\n case 4:\n return '星期四';\n break;\n case 5:\n return '星期五';\n break;\n case 6:\n return '星期六';\n break;\n case 7:\n return '星期天';\n break;\n default:\n break;\n }\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1684ms, 内存消耗: 77828KB, 提交时间: 2022-02-09
{"css":"","js":"function _getday(value) {\n // 补全代码\n return `星期${[,'一','二','三','四','五','六','天'][value]}`\n}","html":"","libs":[]}
HTML/CSS/JavaScript 解法, 执行用时: 1691ms, 内存消耗: 77808KB, 提交时间: 2022-02-09
{"css":"","js":"function _getday(value) {\n // 补全代码\n let arr = ['天', '一', '二', '三', '四', '五', '六'] \n return `星期${arr[value % 7]}`\n}","html":"","libs":[]}