if文|偶数と奇数の条件分岐
if文|偶数と奇数の条件分岐 - jsdo.it - share JavaScript, HTML5 and CSS
スマホ版
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>if文</title> </head> <body> <script type="text/javascript"> var num = 5; if( num % 2 == 0){ document.write(num, 'は偶数です。'); } else { document.write(num, 'は奇数です。'); } </script> </body> </html>