This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a random DNA base | |
const returnRandBase = () => { | |
const dnaBases = ['A', 'T', 'C', 'G']; | |
return dnaBases[Math.floor(Math.random() * 4)]; | |
}; | |
// Returns a random single strand of DNA containing 15 bases | |
const mockUpStrand = () => { | |
const newStrand = []; | |
for (let i = 0; i < 15; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function to check if card number is valid using Luhns algorithm | |
const validateCred = (arr) => { | |
let algArr = []; | |
//starting from right iterate to the left - every other digit is doubled. if doubled number is greater than 9, subtract 9 | |
for (let i = arr.length - 2; i >= 0; i -= 2) { | |
if ((arr[i] * 2) > 9) { | |
algArr.push((arr[i] * 2) - 9); |