Skip to content

Instantly share code, notes, and snippets.

@JossySola
JossySola / dnaSimulation.js
Last active March 29, 2022 05:35
Mysterious Organism Project (Codecademy)
/*
Project Goals
Context: You’re part of a research team that has found a new mysterious organism at the bottom of the ocean near hydrothermal vents. Your team names the organism, Pila aequor (P. aequor), and finds that it is only comprised of 15 DNA bases. The small DNA samples and frequency at which it mutates due to the hydrothermal vents make P. aequor an interesting specimen to study. However, P. aequor cannot survive above sea level and locating P. aequor in the deep sea is difficult and expensive. Your job is to create objects that simulate the DNA of P. aequor for your research team to study.
*/
// Returns a random DNA base
const returnRandBase = () => {
const dnaBases = ['A', 'T', 'C', 'G']
return dnaBases[Math.floor(Math.random() * 4)]
}
@JossySola
JossySola / cardChecker.js
Created March 26, 2022 22:03
Challenge Project: Credit Card Checker (Codecademy)
// All valid credit card numbers
const valid1 = [4, 5, 3, 9, 6, 7, 7, 9, 0, 8, 0, 1, 6, 8, 0, 8];
const valid2 = [5, 5, 3, 5, 7, 6, 6, 7, 6, 8, 7, 5, 1, 4, 3, 9];
const valid3 = [3, 7, 1, 6, 1, 2, 0, 1, 9, 9, 8, 5, 2, 3, 6];
const valid4 = [6, 0, 1, 1, 1, 4, 4, 3, 4, 0, 6, 8, 2, 9, 0, 5];
const valid5 = [4, 5, 3, 9, 4, 0, 4, 9, 6, 7, 8, 6, 9, 6, 6, 6];
// All invalid credit card numbers
const invalid1 = [4, 5, 3, 2, 7, 7, 8, 7, 7, 1, 0, 9, 1, 7, 9, 5];
const invalid2 = [5, 7, 9, 5, 5, 9, 3, 3, 9, 2, 1, 3, 4, 6, 4, 3];
@JossySola
JossySola / linter.js
Created February 5, 2022 18:17
Mini Linter Project / Codecademy
let story = 'Last weekend, I took literally the most beautiful bike ride of my life. The route is called "The 9W to Nyack" and it actually stretches all the way from Riverside Park in Manhattan to South Nyack, New Jersey. It\'s really an adventure from beginning to end! It is a 48 mile loop and it basically took me an entire day. I stopped at Riverbank State Park to take some extremely artsy photos. It was a short stop, though, because I had a really long way left to go. After a quick photo op at the very popular Little Red Lighthouse, I began my trek across the George Washington Bridge into New Jersey. The GW is actually very long - 4,760 feet! I was already very tired by the time I got to the other side. An hour later, I reached Greenbrook Nature Sanctuary, an extremely beautiful park along the coast of the Hudson. Something that was very surprising to me was that near the end of the route you actually cross back into New York! At this point, you are very close to the end.';
let overusedWords = ['really
@JossySola
JossySola / teamstats.js
Created January 30, 2022 01:04
Team Stats Project / Codecademy
let team = {
_players: [{firstName: 'Tom', lastName: 'Daley', age: 27}, {firstName: 'Jack', lastName: 'Laugher', age: 26}, {firstName: 'Matthew', lastName: 'Lee', age: 23}],
_games: [{olympic: 'Tokyo 2022', sport: 'Diving', goldMedals: 1, silverMedals: 0, bronceMedals: 2}, {olympic: 'Rio 2016', sport: 'Diving', goldMedals: 1, silverMedals: 1, bronceMedals: 1}, {olympic: 'London 2012', sport: 'Diving', goldMedals: 0, silverMedals: 0, bronceMedals: 1}],
//////////////////////////////////////////////////////////////
get firstName() {
return this._players['firstName'];
},
get lastName() {
return this._players['lastName'];
},
@JossySola
JossySola / mealmaker.js
Created January 28, 2022 21:30
MEAL MAKER / Codecademy
let menu = {
_courses: {
appetizers: [],
mains: [],
desserts: []
},
get appetizers() {},
set appetizers(appetizerIn){},
@JossySola
JossySola / game.js
Last active January 13, 2022 23:38
Number Guesser Challenge Project (JavaScript) / CODECADEMY
let target;
const humanGuessInput = document.getElementById('human-guess');
const roundNumberDisplay = document.getElementById('round-number');
const computerGuessDisplay = document.getElementById('computer-guess');
const humanScoreDisplay = document.getElementById('human-score');
const computerScoreDisplay = document.getElementById('computer-score');
const targetNumberDisplay = document.getElementById('target-number');
const computerWinsDisplay = document.getElementById('computer-wins');