forked from Zelechos/Pragmatic_JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise3.js
More file actions
21 lines (17 loc) · 866 Bytes
/
Copy pathExercise3.js
File metadata and controls
21 lines (17 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//3) Programa una Funcion que introduzca un limite inferior y un limite superior rellene con numeros la sucesion ejemplo function(2,10) => 2,3,4,5,6,7,8,9,10
const generatorNumbers = (lowerLimit, upperLimit)=>{
let numbers = [];
for(let index = lowerLimit; index <= upperLimit; index++){
numbers.push(index);
}
return numbers;
}
((function (){
let lowerLimit = parseInt(prompt("Enter Lower Limit of the numbers to be displayed : ",0));
let upperLimit = parseInt(prompt("Enter Upper Limit of the numbers to be displayed : ",0));
(!(isNaN(lowerLimit)) || !(isNaN(upperLimit)))
? (lowerLimit !== upperLimit)
? console.log(generatorNumbers(lowerLimit, upperLimit))
: console.error(`the limits cannot be equals!!`)
: console.error(`was expected numbers not => ${typeof lowerLimit} and ${typeof upperLimit}`)
})());