diff --git a/first/.keep b/first/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/first/EvenNumber.js b/first/EvenNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..98af3f11368fdf4b05ef1d00ca3c648729c6bd95 --- /dev/null +++ b/first/EvenNumber.js @@ -0,0 +1,5 @@ +// 8创建一个函数用以判断给定的数字是否是偶数。例如:给函数传递参数12,返回true。 +function IsEvenNubers(num){ + if(num%2==0) return num; +} +alert(IsEvenNubers(12)) \ No newline at end of file diff --git a/first/IsPrimeNumber.js b/first/IsPrimeNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..7c1750bc5d58d6580653af37d8eb58167ce98375 --- /dev/null +++ b/first/IsPrimeNumber.js @@ -0,0 +1,14 @@ +// 2创建一个函数用以判断一个数字是否是质数。例如:给函数传递参数5,返回true;给定函数4,返回false +function IsPrimeNumber(num){ + if(num < 2) return false; + let IsPrimeNumber = true; + for(let i=2;i + + + + + + 刘新飞testHomework + + + + + + + +
+

ZH

+

fly

+
+

+ By: AttentionToDetail +

+ + + + + + + + + + + + + \ No newline at end of file diff --git a/first/max.js b/first/max.js new file mode 100644 index 0000000000000000000000000000000000000000..564017c069004b8db65988157e7bff356b51fdba --- /dev/null +++ b/first/max.js @@ -0,0 +1,7 @@ +// 1创建一个函数用以找到两个数字中较大的数。例如:给函数传递参数4、5,返回5。 +function MaxNum(x1,x2){ + if(x1>=x2) return x1; + else return x2; +} +let maxnum = MaxNum(4,5) +alert(maxnum) \ No newline at end of file diff --git a/first/paixu.js b/first/paixu.js new file mode 100644 index 0000000000000000000000000000000000000000..036ac88af1e319921b718d98df73b1dd87dfc7ea --- /dev/null +++ b/first/paixu.js @@ -0,0 +1,7 @@ +// 10创建一个函数用以将给定的三个数字按从小到大的顺序输出。例如:给函数传递6、4、5,函数运行时会输出4 5 6 +function PaiXu(num1,num2,num3){ + var arr = [num1,num2,num3].sort() + console.log(arr[0] + '<' + arr[1] + '<' + arr[2]); + alert(arr[0] + '<' + arr[1] + '<' + arr[2]); +} +PaiXu(3,5,2) \ No newline at end of file diff --git a/first/primeNumber1to1000.js b/first/primeNumber1to1000.js new file mode 100644 index 0000000000000000000000000000000000000000..06c6c73df577246323162392ff9552b0c37fb912 --- /dev/null +++ b/first/primeNumber1to1000.js @@ -0,0 +1,17 @@ +// 3创建一个函数,运用第2题的函数找到给定区间内的质数。例如:给函数传递参数1、1000,函数将返回1-1000之间的所有质数。 +function FindPrimeNumber(start,end){ + let arr = new Array(); + let x = 0; + for(let i=start;i<=end;i++){ + if(IsPrimeNumber(i)){ + arr[x]=i; + x++; + } + } + return arr; +} +let arrF = FindPrimeNumber(2,1000); +for(let i=0;i=0; x--) { + str1 += str.charAt(x); + } + return str1; +} +alert(StrBack("abc")) \ No newline at end of file diff --git a/first/threeToMax.js b/first/threeToMax.js new file mode 100644 index 0000000000000000000000000000000000000000..cd08006a5013101031619878a5c91c0238533b1a --- /dev/null +++ b/first/threeToMax.js @@ -0,0 +1,17 @@ +// 4创建一个函数,用以找到三个数中最大的数并返回。例如:给函数传递参数6、4、5,返回6 +function MaxNum(x1,x2,x3){ + if(x1>x2){ + if(x1>x3){ + return x1 + }else{ + return x3 + } + } + else if(x2>x3){ + return x2 + } + else{ + return x3 + } +} +alert(MaxNum(6,4,5)) \ No newline at end of file diff --git a/second/.keep b/second/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/second/fly.jpg b/second/fly.jpg new file mode 100644 index 0000000000000000000000000000000000000000..32c281b950e7a2762cc67798ae9dc0c0b591cce4 Binary files /dev/null and b/second/fly.jpg differ diff --git a/second/second.html b/second/second.html new file mode 100644 index 0000000000000000000000000000000000000000..d6b59c67fe593f0271fcd3baea8cb0fa7c23ca1e --- /dev/null +++ b/second/second.html @@ -0,0 +1,67 @@ + + + + + + + Document + + +
+
+ + +
+ + +
+ + + \ No newline at end of file