From 94124c37105a188ae2deac1f50aa7596f1124357 Mon Sep 17 00:00:00 2001 From: Roger David Alba Ortega Date: Thu, 8 Sep 2022 23:14:52 -0500 Subject: [PATCH 1/5] Instal dependencis for to work --- package-lock.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index fd061e8..7f732fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { - "name": "challenge-js-03", + "name": "javascript-challenges", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "challenge-js-03", + "name": "javascript-challenges", "version": "1.0.0", "license": "MIT", "devDependencies": { - "jest": "^29.0.1" + "jest": "29.0.1" } }, "node_modules/@ampproject/remapping": { @@ -5144,8 +5144,7 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz", "integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==", - "dev": true, - "requires": {} + "dev": true }, "jest-regex-util": { "version": "29.0.0", From 2b86fc192846671056cfce18c9a4542d4f50f4e6 Mon Sep 17 00:00:00 2001 From: Roger David Alba Ortega Date: Thu, 8 Sep 2022 23:16:47 -0500 Subject: [PATCH 2/5] Solution of the factorial by passing all the tests --- src/factorial.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/factorial.js b/src/factorial.js index 4f3ae70..509d88d 100644 --- a/src/factorial.js +++ b/src/factorial.js @@ -1,5 +1,25 @@ const factorial = (number) => { - // your code here + let factorial=0; + + if(number===0){ + return 1; + }else{ + + for(let i=0;i Date: Thu, 8 Sep 2022 23:17:11 -0500 Subject: [PATCH 3/5] Solution of the primalidad by passing all the tests --- src/primalidad.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/primalidad.js b/src/primalidad.js index 8bdb849..79ea602 100644 --- a/src/primalidad.js +++ b/src/primalidad.js @@ -1,5 +1,31 @@ const trialDivision = (number) => { - // your code here + const noFloat= number%1===0; + let isCousin=false; + let count=0; + if(number>1 && noFloat){ + for(let i=1;i<=number;i++){ + const numOdd=(number%i === 0); + + if(numOdd){ + count+=1; + }else{ + count=count; + } + if(count>2){ + isCousin=false; + }else{ + isCousin=true + } + + } + + }else{ + isCousin=false; + } + console.log(isCousin) + return isCousin + } +trialDivision(5) module.exports = trialDivision; \ No newline at end of file From 8b0d03d96a9c9cde2aa1562128b54a93f1247bd3 Mon Sep 17 00:00:00 2001 From: Roger David Alba Ortega Date: Fri, 9 Sep 2022 22:57:42 -0500 Subject: [PATCH 4/5] Solution of the fibonacci by passing all the tests --- src/fibonacci.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/fibonacci.js b/src/fibonacci.js index ea3270f..51754b6 100644 --- a/src/fibonacci.js +++ b/src/fibonacci.js @@ -1,5 +1,18 @@ const fibonacci = (n) => { - // your code here + let numFibonacci= []; + if(n ===1){ + numFibonacci.push(1); + }else if(n > 1){ + let numBefore = 0; + let numAfter = 1; + numFibonacci.push(numBefore+numAfter); + for(let i=1;i Date: Fri, 9 Sep 2022 22:58:15 -0500 Subject: [PATCH 5/5] Update dates for pull request --- PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 2449150..2fcd255 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,7 @@ ## DESCRIPTION -Nombre: -Usuario Platzi: +Nombre: Roger David Alba Ortega +Usuario Platzi: rogerdavidalbaortega@gmail.com ## Reto: