Hello Bootstrap Form with JS

check if your number is prime or not

check the number is prime or not !



Number is Prime or Not :

Write a function and logic to check weather Input Number Is prime or not

Javascript File :

  const isPrime=(n)=> {
  let count = 0;
  for (let i = 1; i <= n; i++) {
    if (n % i == 0) {
      count++;
    }
  }

  return count == 2;
}



function checkPrime(){

const in1=document.getElementById("inputbox1")
let value =parseInt(in1.value)
const p =document.getElementById("primePara")
if(isPrime(value)){
    p.textContent= `The Number ${in1.value} is Prime`

}
else{
    p.textContent= `The Number ${in1.value} is Not Prime`
}
}