+ 2
To make counting table
example - input=2 output=2,4,6,8,10,12,14,16,18,20 example2-input=3 output=3,6,9,12,15,18,21,24,27,30
5 Respuestas
+ 3
you can put any number what you want 📌
https://code.sololearn.com/WKF6lMRElwQz/?ref=app
+ 5
let num = parseInt(prompt("Enter a number: "));
let str = "";
for(let i = num; i <= num*10; i+=num) {
str += i;
if(i != num*10) {
str += ", ";
}
}
alert(str);
+ 3
// Normal way in Javascript
var getArray = function(input) {
var outp = [];
for(var i=1;i<=10;i++) outp.push(input*i);
return outp;
}
console.log(getArray(3));
// ES6 way, using arrow function with map
var getArray1=input=>Array.from(Array(10).keys()).map(i=>(i+1)*input);
console.log(getArray1(3));
// another ES6 way
var getArray1=input=>[...Array(10).keys()].map(i=>(i+1)*input);
console.log(getArray1(3));
https://code.sololearn.com/WFAl8QZrgFpt/?ref=app
0
my code Easies simple style
https://code.sololearn.com/cvxfe35Alf7Q/?ref=app