Clean JavaScript solution
\nconst reorderLogFiles = (logs) => {\n  const body = s => s.slice(s.indexOf(\' \') + 1); // get the body after identifier\n  const isNum = c => /\\d/.test(c);\
```\nconst reorderLogFiles = (logs) => {\n  const body = s => s.slice(s.indexOf(\' \') + 1); // get the body after identifier\n  const isNum = c => /\\d/.test(c);\n\n  // if body same then compare identifier\n  const compare = (a, b) => {\n    const n = body(a).localeCompare(body(b));\n    if (n !== 0) return n;\n    return a.localeCompare(b);\n  };\n\n  const digitLogs = [];\n  const letterLogs = [];\n  for (const log of logs) {\n    if (isNum(body(log))) digitLogs.push(log);\n    else letterLogs.push(log);\n  }\n  return [...letterLogs.sort(compare), ...digitLogs];\n};\n```\n
['JavaScript']