Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
https://code.sololearn.com/W8QsOeBp3cpf/?ref=app I changed the interface a little when outputting the result: I now use the table.
30th Sep 2017, 10:06 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 3
then you just need to add it to the array like "array.push(new Side(20, 'b'))"
29th Sep 2017, 11:30 AM
Lord Teacrumble
Lord Teacrumble - avatar
+ 3
@Oma I found an error and added the conversion of the first array to Number so that the sorting was correct. Test it. https://code.sololearn.com/WDPWiyRzjg3Q/?ref=app
30th Sep 2017, 8:39 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 2
@Husnul I have not yet been able to make this option reusable: I can not clear the table. I'm hoping to get a better DOM model to do this too.
1st Oct 2017, 9:30 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
What is it you would really like to do? you could make a solution for this specific problem, but I don't know if it would suit the real problem you are having
29th Sep 2017, 11:10 AM
Lord Teacrumble
Lord Teacrumble - avatar
+ 1
you could make an object with name and length and then put that object into your array are you using javascript?
29th Sep 2017, 11:20 AM
Lord Teacrumble
Lord Teacrumble - avatar
+ 1
the easiest way to do this is via javascript, because you just need to make a function like 'function Side(length, name){this.length = length; this.name = name;}'
29th Sep 2017, 11:29 AM
Lord Teacrumble
Lord Teacrumble - avatar
+ 1
You csn use the concept of ASCII value to sort the second array
29th Sep 2017, 5:04 PM
Shreyash
Shreyash - avatar
29th Sep 2017, 7:35 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
https://code.sololearn.com/cq8zkqPxj9D9/?ref=app
29th Sep 2017, 10:27 PM
张建军
张建军 - avatar
30th Sep 2017, 5:50 AM
Oma Falk
Oma Falk - avatar
+ 1
#vadim does not work...
30th Sep 2017, 8:04 AM
Oma Falk
Oma Falk - avatar
+ 1
@Oma My input is: first array 5,2,8,1 second array Cc,g,ui,r Result: 1...r 2...g 5...Cc 8...ui
30th Sep 2017, 8:19 AM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
@vadim it was not clear to me that I had to enter data since the fields were not empty.
30th Sep 2017, 12:20 PM
Oma Falk
Oma Falk - avatar
+ 1
@Oma I noticed that sorting still does not work correctly, and I changed the program again. It turned out that sort () by default converts values ​​into strings.
30th Sep 2017, 3:10 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
@MobPsycho Yes, this is a problem. But this is a problem of inaccurate formulation of the problem. After sorting the first array ([4,3,6,3] -> [3,3,4,6]) it is not clear which of the original triples is the first and which is the second. And sorting is different: stable and unstable. However, I will try to take into account this.
30th Sep 2017, 3:10 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
30th Sep 2017, 4:19 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
@vadim ...not so bad
30th Sep 2017, 4:23 PM
Oma Falk
Oma Falk - avatar
+ 1
@Oma On Python it was better - I know him better, and I master JavaScript on the go. Here the material is still small, they give only the very basics, so we have to look for more detailed information in other sources.
30th Sep 2017, 4:28 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar
+ 1
#MobPsycho I made a 2 versions with the possibility of repetition.
30th Sep 2017, 4:31 PM
Вадим Сухотин (Vadim Sukhotin)
Вадим Сухотин (Vadim Sukhotin) - avatar