Skip to content

Day3:写出执行结果,并解释原因 #39

@Genzhen

Description

@Genzhen
Collaborator
var min = Math.min();
max = Math.max();
console.log(min < max);
// 写出执行结果,并解释原因

每日一题会在下午四点在交流群集中讨论,五点小程序中更新答案
欢迎大家在下方发表自己的优质见解
二维码加载失败可点击 小程序二维码

扫描下方二维码,收藏关注,及时获取答案以及详细解析,同时可解锁800+道前端面试题。

Activity

Genzhen

Genzhen commented on Jun 22, 2020

@Genzhen
CollaboratorAuthor

答案
false

解析

  • 按常规的思路,这段代码应该输出 true,毕竟最小值小于最大值。但是却输出 false
  • MDN 相关文档是这样解释的
    • Math.min 的参数是 0 个或者多个,如果多个参数很容易理解,返回参数中最小的。如果没有参数,则返回 Infinity,无穷大。
    • 而 Math.max 没有传递参数时返回的是-Infinity.所以输出 false
Kinice

Kinice commented on Aug 31, 2020

@Kinice

个人感觉这题意义不大。。

Genzhen

Genzhen commented on Sep 3, 2020

@Genzhen
CollaboratorAuthor

个人感觉这题意义不大。。

对于知识来说,多了解一点总没有坏处

Kinice

Kinice commented on Sep 3, 2020

@Kinice

个人感觉这题意义不大。。

对于知识来说,多了解一点总没有坏处

说得没错~

yuanhaotian

yuanhaotian commented on Jun 12, 2023

@yuanhaotian

还是得看,因为一些公司就面这,做为附加题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Kinice@Genzhen@yuanhaotian

        Issue actions

          Day3:写出执行结果,并解释原因 · Issue #39 · lgwebdream/FE-Interview