M

@miguladg

Are they the "same"?

NodeJS
1 year ago
function comp(array1, array2){ console.log('array1:', array1, 'array2:', array2) if (!Array.isArray(array1) || !Array.isArray(array2)) { return false; } for (let i = 0; i < array1.length; i++ ) { // console.log(i); if ( Math.p

Arrow Function 19

NodeJS
1 year ago
const event = { name: 'Birthday Party', guestList: ['Andrew', 'Jen', 'Mike'], printGuestList() { console.log('Guest list for ' + this.name) this.guestList.forEach((guest)=> { console.log(guest + 'is attending

Rot13

NodeJS
1 year ago
function rot13(message){ console.log(message) const alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''); const alphabetMayo = 'abcdefghijklmnopqrstuvwxyz'.toUpperCase().split(''); let rot = [] let fin = [] const arrayMe = message.toLowe

So Many Permutations!

NodeJS
1 year ago
function permutations(string) { // Función recursiva para generar permutaciones function generatePerms(str) { if (str.length <= 1) { // console.log('generatePerms') return [str]; } let allPerms = [];

Felipe

Python
1 year ago
def solution(args): print(args) # your code here jesus = "" mango = [] for i in args: if i in mango: continue

twoSum

NodeJS
1 year ago
function twoSum(numbers, target) { for (var i = 0; i < numbers.length-1; i++) { for (var j = i+1; j < numbers.length; j++) { if (numbers[i] + numbers[j] === target) console.log(i, j); } } } twoSum([1, 2, 3], 4)

Count the divisors of a number

NodeJS
2 years ago
function getDivisorsCnt(n){ var num=0; if(n==1) return 1; if(n%Math.sqrt(n)==0) num++; for(var i=1;i<Math.sqrt(n);i++){ if(n%i==0){ num+=2; } } return num;

Who likes it?

NodeJS
2 years ago
/* * You probably know the "like" system from Facebook and other pages. * People can "like" blog posts, pictures or other items. * We want to create the text that should be displayed next to such an item. * * Implement the function which take

I love you, a little , a lot, passionately ... not at all

NodeJS
2 years ago
function howMuchILoveYou(nbPetals) { let phrase = { 0: "not at all", 1: "I love you", 2: "a little", 3: "a lot", 4: "passionately", 5: "madly" } return phrase[nbPetals%6]

case

NodeJS
2 years ago
function basicOp(operation, value1, value2) { var cases = { '+': value1 + value2, '-': value1 - value2, '*': value1 * value2, '/': value1 / value2 }; return cases[operation] }

Basic Mathematical Operations

NodeJS
2 years ago
// function basicOp(operation, value1, value2){ // return eval(`${value1} ${operation} ${value2}`); // } // Para convertir un string en parte del código JavaScript y ejecutarlo, puedes usar la función `eval()`. Sin embargo, es importante tene

Find the odd int

NodeJS
2 years ago
// Given an array of integers, find the one that appears an odd number of times. // There will always be only one integer that appears an odd number of times. // Examples // [7] should return 7, because it occurs 1 time (which is odd). // [0] shou

Your order, please

NodeJS
2 years ago
// DESCRIPTION: // Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result. // Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).

Estudiar

NodeJS
2 years ago
function pickPeaks(arr) { let pos = []; let peaks = []; for (let i = 1; i < arr.length - 1; i++) { if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) { pos.push(i); peaks.push(arr[i]); } else if (arr

Estudiar forEach

NodeJS
2 years ago
function duplicateCount(text){ var lower = text.toLowerCase(); var count = 0; var used = []; lower.split('').forEach( function(letter) {if (!used.includes(letter) && (lower.split(letter).length - 1) > 1) {count++; used.push(letter);

Ejemplos de propytas array

NodeJS
2 years ago
//primera parte function duplicateCount(text){ var textArray = text.split(''); // console.log(textArray); // const numberText = textArray.find((element) => element === "l"); // console.log(numberText); }

coodern Best options

NodeJS
2 years ago
function isValidWalk(walk) { // //insert brilliant code here console.log(walk); // see the data console.log(walk.length) const sumN = (walk.filter((walkD) => walkD === 'n')).length // 1 const sumS = (walk.filter((walkD) => walkD === 's'))

Example test array

NodeJS
2 years ago
function isValidWalk(walk) { console.log(walk); var coorden = ['n', 's', 'e', 'w'] // (walk.filter((walkD) => walkD === 'n')).length function COO(params) {

Learn JavaScript - Full Course for Beginners - Array

NodeJS
2 years ago
// Manipulate Arrays with pop() var ourArray = [1, 2, 3]; var removedFromOurArray = ourArray.pop(); console.log(removedFromOurArray) // Setup

Learn JavaScript - Full Course for Beginners

NodeJS
2 years ago
// // Setup // var lastName = "LoveLace"; // var lastLetterOfLastName = lastName[lastName.length - 1]; // console.log(lastLetterOfLastName); // // blocks // function wordBlanks(myNoun, myAdjective, myVerb, myAdverb) {