Fixed Whitespace, Operators, and Quotes to Comply with JSLint

I modified the whitespace in the files and changed single quotes to double quotes.

I also changed some `==` and `!=` operators to `===` and `!==` to comply with JSLint.
This commit is contained in:
PatOnTheBack
2019-06-27 10:41:44 -04:00
parent 2c1cd5595a
commit f37cac8508
8 changed files with 143 additions and 143 deletions

View File

@ -5,7 +5,7 @@ function euclideanGCDRecursive (first, second) {
:param second: Second number :param second: Second number
:return: GCD of the numbers :return: GCD of the numbers
*/ */
if (second == 0) { if (second === 0) {
return first; return first;
} else { } else {
return euclideanGCDRecursive(second, (first % second)); return euclideanGCDRecursive(second, (first % second));
@ -19,7 +19,7 @@ function euclideanGCDIterative (first, second) {
:param second: Second number :param second: Second number
:return: GCD of the numbers :return: GCD of the numbers
*/ */
while (second != 0) { while (second !== 0) {
let temp = second; let temp = second;
second = first % second; second = first % second;
first = temp; first = temp;

View File

@ -27,12 +27,12 @@ function rot13(str) {
} }
} }
return response.join(''); return response.join("");
} }
// Caesars Cipher Example // Caesars Cipher Example
const encryptedString = 'Uryyb Jbeyq'; const encryptedString = "Uryyb Jbeyq";
const decryptedString = rot13(encryptedString); const decryptedString = rot13(encryptedString);
console.log(decryptedString); // Hello World console.log(decryptedString); // Hello World

View File

@ -4,7 +4,7 @@ function decimalToBinary(num) {
bin.unshift(num % 2); bin.unshift(num % 2);
num >>= 1; // basically /= 2 without remainder if any num >>= 1; // basically /= 2 without remainder if any
} }
console.log("The decimal in binary is " + bin.join('')); console.log("The decimal in binary is " + bin.join(""));
} }
decimalToBinary(2); decimalToBinary(2);

View File

@ -8,14 +8,14 @@
function binarySearch(arr, i) { function binarySearch(arr, i) {
var mid = Math.floor(arr.length / 2); var mid = Math.floor(arr.length / 2);
if (arr[mid] === i) { if (arr[mid] === i) {
console.log('match', arr[mid], i); console.log("match", arr[mid], i);
return arr[mid]; return arr[mid];
} else if (arr[mid] < i && arr.length > 1) { } else if (arr[mid] < i && arr.length > 1) {
binarySearch(arr.splice(mid, Number.MAX_VALUE), i); binarySearch(arr.splice(mid, Number.MAX_VALUE), i);
} else if (arr[mid] > i && arr.length > 1) { } else if (arr[mid] > i && arr.length > 1) {
binarySearch(arr.splice(0, mid), i); binarySearch(arr.splice(0, mid), i);
} else { } else {
console.log('not found', i); console.log("not found", i);
return -1; return -1;
} }