Javascript &引用;TypeError:Math.Floor不是HtmlButtoneElement.onclick加载时的函数(<;anonymous>;:4:17)

Javascript &引用;TypeError:Math.Floor不是HtmlButtoneElement.onclick加载时的函数(<;anonymous>;:4:17),javascript,html,Javascript,Html,我在一个简单的俄罗斯轮盘赌模拟器的基地工作。代码如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>RR</title> </head> <body> <button onclick=load()>Load</button> <button onclick=fire()>tr

我在一个简单的俄罗斯轮盘赌模拟器的基地工作。代码如下:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>RR</title>
</head>
<body>
  <button onclick=load()>Load</button>
  <button onclick=fire()>trigger</button>
  <script>
    var slot=0;
    var load=function(){
    slot=Math.Floor(Math.random()*6+1);
};
var fire=function(){
  slot=slot-1;
  if(slot===0){
    confirm("BANG!!");
  }else{
    if(slot<0){
      confirm("There is no bullet in this gun.");
    }
  }
};
</script>
</body>
</html>

RR
负载
触发
var时隙=0;
var load=function(){
slot=Math.Floor(Math.random()*6+1);
};
var fire=函数(){
槽=槽-1;
如果(插槽===0){
确认(“砰!!”);
}否则{
如果(槽改变

slot=Math.Floor(Math.random()*6+1);


正如罗兰和斯特林所指出的,floor函数以小写字母f开头。

Js是区分大小写的use Math。floor@RolandStrake你是什么意思?他的意思是
Floor
!=
Floor
slot=Math.floor(Math.random()*6+1);