热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

很有意思的一道题

题目内容ThetestfixtureIuseforthiskataispre-populated.Itwillcompareyourguesstoarandomnumbergene

题目内容

The test fixture I use for this kata is pre-populated.

It will compare your guess to a random number generated using:

Math.floor(Math.random() * 100 + 1)

You can pass by relying on luck or skill but try not to rely on luck.

"The power to define the situation is the ultimate power." - Jerry Rubin

Good luck!

答题区

var guess = 0; //编写这部分内容以满足如下的test

验证区

//This is exactly what the real test fixture looks like.
var lucky_number = Math.floor(Math.random() * 100 + 1);
Test.assertEquals(guess, lucky_number, "Sorry. Unlucky this time.");

建议大家动手写一写,再去翻看原答案,不要被思想所束缚~

引用Codewars
参考答案



推荐阅读
author-avatar
xillb_486
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有