There is a working code that counts the area according to the Gerona formula from a triangle, using empty arrays, which I fill in the console with the .push(); method .push();

Task: I need the code below in the triangleList() function to describe the first part of the names array and the result obtained by calculating according to the Heron formula, and also this list performed sorting in descending order from a large triangle to a smaller one.

 var names = []; var a = []; var b = []; var c = []; console.log("напиши *createTriangle()*"); console.log("ΠΊΠ°ΠΊ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Ρ‚Ρ‹ Π·Π°ΠΊΠΎΠ½Ρ‡ΠΈΠ» всС дСйствия, пиши Π² консоль *end()*") function createTriangle() { console.log("напиши *names.push( ^Имя Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *a.push( ^Π Π°Π·ΠΌΠ΅Ρ€ ΠΏΠ΅Ρ€Π²ΠΎΠΉ стороны Ρ‚Ρ€ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *b.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Π²Ρ‚ΠΎΡ€ΠΎΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *c.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Ρ‚Ρ€Π΅Ρ‚ΡŒΠ΅ΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") }; function end() { console.log("Ссли Ρ‚Ρ‹ Ρ…ΠΎΡ‡Π΅ΡˆΡŒ ΠΏΡ€ΠΎΠ΄ΠΎΠ»ΠΆΠΈΡ‚ΡŒ пиши *y()* ΠΈΠ»ΠΈ *yes()*, Π² ΠΏΡ€ΠΎΡ‚ΠΈΠ²Π½ΠΎΠΌ случаС пиши *no()* ΠΈΠ»ΠΈ *n()*") }; function yes() { console.log("напиши *names.push( ^Имя Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *a.push( ^Π Π°Π·ΠΌΠ΅Ρ€ ΠΏΠ΅Ρ€Π²ΠΎΠΉ стороны Ρ‚Ρ€ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *b.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Π²Ρ‚ΠΎΡ€ΠΎΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *c.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Ρ‚Ρ€Π΅Ρ‚ΡŒΠ΅ΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("пиши *end()* ΠΊΠ°ΠΊ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π·Π°ΠΊΠΎΠ½Ρ‡ΠΈΠ»") }; function y() { console.log("напиши *names.push( ^Имя Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *a.push( ^Π Π°Π·ΠΌΠ΅Ρ€ ΠΏΠ΅Ρ€Π²ΠΎΠΉ стороны Ρ‚Ρ€ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *b.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Π²Ρ‚ΠΎΡ€ΠΎΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("напиши *c.push( ^Π Π°Π·ΠΌΠ΅Ρ€ Ρ‚Ρ€Π΅Ρ‚ΡŒΠ΅ΠΉ стороны Ρ‚Ρ€Π΅ΡƒΠ³ΠΎΠ»ΡŒΠ½ΠΈΠΊΠ°^ )*") console.log("пиши *end()* ΠΊΠ°ΠΊ Ρ‚ΠΎΠ»ΡŒΠΊΠΎ Π·Π°ΠΊΠΎΠ½Ρ‡ΠΈΠ»") }; function geron(s) { if ((a > 0) || (b > 0) || (c > 0) || ((a + b > c) || (b + c > a) || (a + c > b))) { var p = (a + b + c) * 0.5; var s = Math.sqrt(p * (p - a) * (p - b) * (p - c)); return sorting(s); } else { console.log("ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΏΠ»ΠΎΡ‰Π°Π΄ΡŒ Π½Π΅ ΡƒΠ΄Π°Π»ΠΎΡΡŒ. А Π·Π½Π°Ρ‡ΠΈΡ‚ ΡΠΎΠ²Π΅Ρ‚ΡƒΡŽ Π½Π°Ρ‡Π°Ρ‚ΡŒ всё сначала"); } } function sorting(s) { var n = s.length; for (var i = 0; i < n - 1; i++) { var min = i; for (var j = i + 1; j < n; j++) { if (s[j] < s[min]) min = j; } var t = s[min]; s[min] = s[i]; s[i] = t; } return triangleList(); }; function no() { return geron(); }; function n() { return geron(); }; function triangleList() {} 

    0