Challenge: Write your worst program

Hi everyone,
As you may know, there is no way in JavaScript to determine whether or not a number is a multiple of another number, so I wrote this function.

function isMultiple(big, small){
    return (big/small + "").indexOf('.') < 0;
}

Enter fullscreen mode Exit fullscreen mode

Now you can use this in your code as well. You’re welcome. Got any other tips for me? I am looking for functions, that can ease my programming life. Any programming language is appreciated.

EDIT: Some quick edit, because there seems to be confusion. This introductory text is supposed to be sarcastic. I know there is a % operator. I know this function does not make sense and that it is super inefficient. The challenge is, that you should provide pieces of code that are (on purpose or not) weired or way too complicated or inefficient or useless.

原文链接:Challenge: Write your worst program

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容