+ 2
How we can do it?
how we can give four numbers that are user inputs to js and js put them in an array in an order like this: var arr=[1,2,3,4 ] or var arr=[4,3,2,1] please help me
7 odpowiedzi
+ 7
If you want to add multiple variables into an array you can use:
var arr = [a, b, c, d];
to sort or reverse them use:
arr.sort()
or
arr.reverse()
+ 5
Programmer You're welcome!
+ 3
Here is an example code using the .sort() method:
https://code.sololearn.com/WM3siEnWYqz5/?ref=app
+ 1
var a=1;
var b=2;
var c=3;
var d=4;
var arr = Array.prototype.concat(a,b,c,d);
console.log(arr.join(","));
arr = Array.prototype.concat(d,c,b,a);
console.log(arr.join(","));
https://code.sololearn.com/W4X5Li4pf89k/?ref=app
+ 1
no you dont get my mean
i mean four varibles that are user inputs
and i want java script to put them in an array in order
please answer
0
I want to see your attempt
Please show your codes.
0
thanks all of you