Answers for "javascript calculate when there is new number in variable"

0

get the whole value of a number javascript

var value = 2.9802453587962963;
var wholeNum = Math.floor(value);
console.log(wholeNum);  // output ==> 2
Posted by: Guest on September-01-2020
0

primitive numbers javascript coding sample increas by 1

function test_prime(n){
  if (n===1) {
    return false;
  }else if(n === 2){
    return true;
  }else{
    for(var x = 2; x < n; x++){
      if(n % x === 0){
        return false;
      }
    }
    return true;  
  }
}

console.log(test_prime(37));
Posted by: Guest on May-27-2020

Code answers related to "javascript calculate when there is new number in variable"

Code answers related to "Javascript"

Browse Popular Code Answers by Language