|
@@ -1,38 +1,41 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
+
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>Document</title>
|
|
|
</head>
|
|
|
+
|
|
|
<body>
|
|
|
<script>
|
|
|
|
|
|
// 判断传过来的数字能否被3 5 7整除
|
|
|
// 如果成立则返回true(真) 否则返回false(假)
|
|
|
- function foo(num){
|
|
|
- if(num%3 == 0 && num%5==0 && num%7 == 0){
|
|
|
+ function foo(num) {
|
|
|
+ if (num % 3 == 0 && num % 5 == 0 && num % 7 == 0) {
|
|
|
return true;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var count = 0;
|
|
|
- for(var i = 1;i<1000;i++){
|
|
|
+ for (var i = 1; i < 1000; i++) {
|
|
|
var val = foo(i);
|
|
|
- if(val){
|
|
|
- document.write(i+" ");
|
|
|
+ if (val) {
|
|
|
+ document.write(i + " ");
|
|
|
count++;
|
|
|
- if(count%6==0){
|
|
|
- document.write("<br>");
|
|
|
- }
|
|
|
+ if (count % 6 == 0) {
|
|
|
+ document.write("<br>");
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
+
|
|
|
</html>
|