論理和の計算
<!doctype html> <html> <head> <meta charset="utf-8"> <title>無題ドキュメント</title> </head> <script type="text/javascript"> var testValue1 = 1; var testValue2 = 2; var returnValue1 = testValue1 & 1; var returnValue2 = testValue1 & 2; var returnValue3 = testValue1 & 3; document.write("testValue = " + testValue1 + " & 01 = " + returnValue1 + " " + testValue1 + " & 10 = " + returnValue2 + " " + testValue1 + " & 11 = " + returnValue3 + "<br />"); returnValue1 = testValue2 & 1; returnValue2 = testValue2 & 2; returnValue3 = testValue2 & 3; document.write("testValue = " + testValue2 + " & 01 = " + returnValue1 + " " + testValue2 + " & 10 = " + returnValue2 + " " + testValue2 + " & 11 = " + returnValue3 + "<br />"); </script> <body> </body> </html>