JSFiddle - React, Tailwind, and code Playground
JavaScript
Number.prototype.isPrime = function() {
if ( this === 0 || this === 1 ) {
return false;
}
for ( var i = 2; i < this; i++ ) {
if ( this % i === 0 ) {
return false;
}
}
return true;
};
var arr = [2,4,5,13,15,121];
for ( var i = 0; i < arr.length; i++ ) {
console.log(arr[i].isPrime());
}