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>
</body>
</html>
 
window.addEventListener("load",function(){
    var n=window.prompt("請輸入一個數字N");
    var m=n %2; //算餘數
    if (m==0) window.alert(n+"是偶數");
    else window.alert(n+"是奇數"); 
});
Output 300px

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

Dismiss x
public
Bin info
yaoyao34pro
0viewers