Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"cSpell.words": [
"Barajas",
"Cuarto",
"Curso",
"Empoderatech",
"GRUPO",
"GUAMAN",
"Hamburguesa",
"Jueves",
"Martes",
"Miercoles",
"Nombre",
"Opcional",
"Orden",
"Pedido",
"Platzi",
"Profesional",
"Reto",
"Tercer",
"Usuario",
"n",
"preparaci",
"preparación",
"problema",
"servido",
"tiempo"
]
}
10 changes: 5 additions & 5 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
## DESCRIPTION

Solución al reto 04 de Escuela de JavaScript
Reto 2: Curso de Profesional de JavaScript

Nombre:
Usuario Platzi:
Nombre: ALEXANDER GUAMAN CRUZ
Usuario Platzi: https://platzi.com/@alexanderguamancruz/

## GRUPO
- [ ] Martes
- [X] Martes
- [ ] Miercoles
- [ ] Jueves

## Reto:
- [ ] Primer problema
- [X] Primer problema
- [ ] Segundo problema
- [ ] Tercer problema
- [ ] Cuarto Problema (Opcional)
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "escuelajs-reto-04",
"version": "1.0.0",
"description": "Reto 4 Septiembre 21: Curso de Fundamentos de JavaScript",
"name": "curso-profesional-js",
"version": "1.1.0",
"description": "javascript challenge 02",
"main": "index.js",
"scripts": {
"start": "node src/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/platzi/escuelajs-reto-04.git"
"url": "https://github.com/AGCGUAMAN/javascript-challenge-02.git"
},
"keywords": [
"javascript",
"escuelajs",
"Empoderatech",
"platzi",
"node"
],
"author": "Oscar Barajas <oscar@platzi.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/platzi/escuelajs-reto-04/issues"
"url": "https://github.com/gndx/javascript-challenge-02.git"
},
"homepage": "https://github.com/platzi/escuelajs-reto-04#readme"
"homepage": "https://github.com/gndx/javascript-challenge-02"
}
19 changes: 15 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
const max = 8000;

const min = 1000;

const randomTime = (max, min) => {
return Math.round(Math.random() * (max - min)) + min;
}

const orders = (time, product, table) => {
console.log(`### Orden: ${product} para ${table}`);
console.log(`Orden ###: ${product} para ${table}`);
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(`=== Pedido servido: ${product}, tiempo de preparación ${time}ms para la ${table}`);
}, time);
if(randomTime(max, min) <= time) {
setTimeout(() => {
resolve(`=== Pedido servido: ${product}, tiempo de preparación ${time}ms para la ${table}`);
}, time);
}
else {reject(new Error(Error))};
});
}

Expand Down