This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let fs = require("fs"); | |
| const personaString = fs.readFileSync("personas.json").toString(); | |
| const objetoPersona = JSON.parse(personaString); | |
| const getAll = () => { | |
| return objetoPersona; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const modProducts = require("./products"); | |
| function main() { | |
| const productById = modProducts.getOne(13); | |
| console.log("Product By Id:\n", productById); | |
| const allTheProducts = modProducts.getAll(); | |
| console.log("All The Products:\n", allTheProducts); | |
| const productByStock = modProducts.getAllWhith(3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️ | |
| // Completar acá. | |
| // Escribir la función soloObjetosConNombreYApellido() | |
| // y pasar el test. | |
| const soloObjetosConNombreYApellido = function (item) { | |
| //Solo queria comentar que tambien encontre esta forma de hacerlo, ambas funcionan. | |
| /*const selectString = function (item) { | |
| if (typeof item.nombre === "string") { | |
| return item; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️🏴☠️ | |
| // Completar acá. | |
| // Escribir la función textosCortos y pasar el test. | |
| function textosCortos(text) { | |
| const list = []; | |
| for (var i = 0; i < text.length; i++) { | |
| var obj = text[i]; | |
| const capacidadObjeto = obj.texto.split(" "); | |
| count = 0; | |
| if (capacidadObjeto.length < 10) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Escribir acá la función cuentaPalabras | |
| function cuentaPalabras(texto){ | |
| var arrayPalabras = texto.split(" "); | |
| var cantidadDePalabras = arrayPalabras.length; | |
| var palabrasConA = 0; | |
| for(var i = 0; i < arrayPalabras.length; i++){ | |
| var palabraActual = arrayPalabras[i]; | |
| primeraLetra = palabraActual.charAt(0); | |
| if(primeraLetra == "a"){ | |
| palabrasConA++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function numberRandom(counter) { | |
| var list = []; | |
| while (counter<20) { | |
| var numberRandom = Math.floor(Math.random()*10); | |
| list.push({text: " Hello_There " + counter, number: numberRandom}); | |
| counter++; | |
| } | |
| return list; | |
| } |
NewerOlder