+ 15

What it means ...arr

I see code Arr2 = [...arr] In one of challenges (propably ruby) What does it means (with comas)?

22nd Apr 2019, 8:14 PM
Sławek J.
5 ответов
+ 18
There is nothing about this comass ... before "arr" text
23rd Apr 2019, 7:11 AM
Sławek J.
+ 5
In JS ... stands for rest parameters.
24th Apr 2019, 2:17 AM
Sonic
Sonic - avatar
+ 2
I don't have the ruby course on here so I don't have the link for that but the php should explain it as well https://www.sololearn.com/learn/PHP/1807/
23rd Apr 2019, 6:11 AM
Lexfuturorum
Lexfuturorum - avatar
+ 1
It's a range object in ruby which contains numbers from n to m (n..m) or n till m (n...m) 2-dots mean inclusive of m, 3 means exclude m. arr = [1, 20...30, 9] puts (10..20).size #20 puts arr.length #11 puts (1..6).to_a You can check this stackoverflow post for additional info https://stackoverflow.com/questions/9690801/difference-between-double-dot-and-triple-dot-in-range-generation
28th Apr 2019, 4:38 AM
Lord Krishna
Lord Krishna - avatar
0
That's nothing else than a symbolic for a array filled with variables
23rd Apr 2019, 7:19 AM
Lexfuturorum
Lexfuturorum - avatar