Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>買冰棒</title>
</head>
<body>
<button>123</button>
</body>
</html>
 
window.addEventListener("load",function(){
        console.clear();
        var n=window.prompt("輸入冰棒數量");
       var m=window.prompt("輸入單價");
       if (n*m>=1000){
            console.log("8折",n*m*0.8);
        }else{
            console.log("原價",n*m);
        }
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
yaoyao34pro
0viewers