Pregunta de entrevista de Infrrd

An array was given i.e myArray={3,57,64,452,234,9,7,98} Write a function in JS to form the largest number from this array. O/p should be:998764574523234

Respuesta de la entrevista

Anónimo

26 ago 2020

const array = [23, 54, 904, 43]; let a = Number(array.toString().replace(/,/g, '').split('').sort((a, b) => b -a ).join('')); console.log(a)