diff --git a/README.md b/README.md index 39f165be1..715b1a3c9 100644 --- a/README.md +++ b/README.md @@ -1224,9 +1224,10 @@ Checks if the provided integer is a prime number. Returns `false` if the provided number has positive divisors other than 1 and itself or if the number itself is less than 2. ```js -const isPrime = num => +const isPrime = num => { for (var i = 2; i < num; i++) if (num % i == 0) return false; return num >= 2; +} // isPrime(11) -> true // isPrime(12) -> false // isPrime(1) -> false diff --git a/docs/index.html b/docs/index.html index 7648b07e7..d0bd32993 100644 --- a/docs/index.html +++ b/docs/index.html @@ -765,9 +765,10 @@ Returns true if the number is even, false if the numbe

isPrime

Checks if the provided integer is a prime number.

Returns false if the provided number has positive divisors other than 1 and itself or if the number itself is less than 2.

-
const isPrime = num =>
+
const isPrime = num => {
   for (var i = 2; i < num; i++) if (num % i == 0) return false;
   return num >= 2;
+}
 // isPrime(11) -> true
 // isPrime(12) -> false
 // isPrime(1) -> false
diff --git a/snippets/isPrime.md b/snippets/isPrime.md
index b372f057f..cc1f69b14 100644
--- a/snippets/isPrime.md
+++ b/snippets/isPrime.md
@@ -5,9 +5,10 @@ Checks if the provided integer is a prime number.
 Returns `false` if the provided number has positive divisors other than 1 and itself or if the number itself is less than 2.
 
 ```js
-const isPrime = num =>
+const isPrime = num => {
   for (var i = 2; i < num; i++) if (num % i == 0) return false;
   return num >= 2;
+}
 // isPrime(11) -> true
 // isPrime(12) -> false
 // isPrime(1) -> false