Skip to content

Instantly share code, notes, and snippets.

// 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++) {
// 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);