Home >
front end > Write a function that users determine whether as a prime number, and the pop-up return value (also c
Write a function that users determine whether as a prime number, and the pop-up return value (also c
<meta charset="utf-8" & gt;
<meta name="viewport" content="width=device - width, initial - scale=1.0" & gt;
<meta HTTP - equiv="X - UA - Compatible" content="ie=edge" & gt;
Document <script>
The function getDate (num1) {
Var cuont=0;
For (var I=1; i <=num1; I++) {
If (num1 % I==0) {
count++;
}
}
If (count==2) {
Return num1.
} else {
The console. The log (' is not a prime number);
}
}
The console. The log (getDate (2));
</script>
<body>