已解决
0037【Edabit ★☆☆☆☆☆】【修改Bug 2】Buggy Code (Part 2)
来自网友在路上 154854提问 提问时间:2023-10-30 10:04:29阅读次数: 54
最佳答案 问答题库548位专家为你答疑解惑
0037【Edabit ★☆☆☆☆☆】【修改Bug 2】Buggy Code (Part 2)
bugs
language_fundamentals
Instructions
Fix the code in the code tab to pass this challenge (only syntax errors). Look at the examples below to get an idea of what the function should do.
Examples
maxNum(3, 7) // 7
maxNum(-1, 0) // 0
maxNum(1000, 400) // 1000
Notes
- READ EVERY WORD CAREFULLY, CHARACTER BY CHARACTER!
- Don’t overthink this challenge; it’s not supposed to be hard.
Solutions
// bugs
function maxNum(n1;n2) { // here,between paramters using `,` instead of `;`if (n1>n2) {return n2 // here , we should return max number,n1}else if { // and here,remove `if`return n1}
}
// correct it !!
function maxNum(n1,n2) {if (n1>n2) {return n1} else {return n1}
}
TestCases
let Test = (function(){return {assertEquals:function(actual,expected){if(actual !== expected){let errorMsg = `actual is ${actual},${expected} is expected`;throw new Error(errorMsg);}}}
})();Test.assertEquals(maxNum(3, 7), 7)
Test.assertEquals(maxNum(-1, 0), 0)
Test.assertEquals(maxNum(1000, 400), 1000)
Test.assertEquals(maxNum(-3, -9), -3)
Test.assertEquals(maxNum(88, 90), 90)
查看全文
99%的人还看了
相似问题
- 图数据库Neo4J 中文分词查询及全文检索(建立全文索引)
- MongoDB 全文检索
- ElasticSearch 实现 全文检索 支持(PDF、TXT、Word、HTML等文件)通过 ingest-attachment 插件实现 文档的检索
- 2023年AI行业报告(附全文下载)
- mysql 全文检索 demo
- 软件开发全文档归档,开发、管理、实施、运维、服务巡检、信息安全、安全运维
- Android启动优化-全文详细
- 如何实现 Es 全文检索、高亮文本略缩处理
- Elasticsearch实现全文搜索的步骤和实现原理
- Elasticsearch(Es搜索(简单使用、全文查询、复合查询)、地理位置查询、特殊查询、聚合操作、桶聚合、管道聚合)
猜你感兴趣
版权申明
本文"0037【Edabit ★☆☆☆☆☆】【修改Bug 2】Buggy Code (Part 2)":http://eshow365.cn/6-27767-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: 搜狗百科创建步骤
- 下一篇: 【Unity ShaderGraph】| 快速制作一个 卡通阴影色块效果