Skip to content

Instantly share code, notes, and snippets.

View diegotauchert's full-sized avatar

Diego Tauchert diegotauchert

View GitHub Profile
@diegotauchert
diegotauchert / gist:82635d52ae697a64756650554db3fff7
Created February 8, 2022 02:02
Strip Property function, hackerrank Javascript code chalenge
function stripProperty(obj, prop) {
const newObj = Object.keys(obj).filter(el => el !== prop)
const values = newObj.map(el => [el, obj[el]])
return Object.fromEntries(values)
}
@diegotauchert
diegotauchert / palindromes.js
Last active October 8, 2020 20:55
Script that creates an array with 10000 random words between 3 and 5 characteres, and returns the words that are palindromes in that array
const main = () => {
var characters = 'abcdefghijklmnopqrstuvwxyz';
var charactersLength = characters.length;
var words = [];
var wordsPalindromes = [];
for(var j = 0; j < 10000; j++){
var wordLength = Math.floor(Math.random() * (5 - 3 + 1) ) + 3;
var word = '';
for ( var i = 0; i < wordLength; i++ ) {