Skip to content

Instantly share code, notes, and snippets.

View germancutraro's full-sized avatar
🖤

Ger Cutraro germancutraro

🖤
View GitHub Profile
@germancutraro
germancutraro / memo.js
Last active January 5, 2020 02:52
Easy memorizing function js
const calcs = {};
const sum = (a,b) => {
let key = 'sum' + (a+b).toString();
if ( key in calcs )
return 'found: ' + calcs[key]
let total = a + b;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
:root {
--circle: 5px;
--background: #fff;
@germancutraro
germancutraro / fizzbuzz.js
Last active September 2, 2017 19:26
Fizz Buzz Algorithms in JavaScript by germancutraro
function fizzBuzz (num) {
for (i = 1; i <= num; i++) {
let fizz = i % 3 === 0,
buzz = i % 5 === 0;
console.log(fizz && buzz ? 'fizzBuzz' : fizz ? 'Fizz' : buzz ? 'Buzz' : i);
} // end for loop
}
fizzBuzz(20);