@lydiahallie/

BarrenBothVirus

Nodejs

No description

fork
loading
Files
  • index.js

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.7729557245682581","path":"index.js","file":{"path":"index.js","content":{"asEncoding":{"base64":"CmZ1bmN0aW9uIGJ1YmJsZVNvcnQoYXJyYXkpIHsKICBmb3IgKGxldCBpID0gMDsgaSA8IGFycmF5Lmxlbmd0aDsgaSsrKSB7CiAgICBpZiAoYXJyYXlbaV0gPiBhcnJheVtpICsgMV0pIHsKICAgICAgW2FycmF5W2ldLCBhcnJheVtpICsgMV1dID0gW2FycmF5W2kgKyAxXSwgYXJyYXlbaV1dCiAgICB9CiAgfQogIHJldHVybiBhcnJheQp9CgpidWJibGVTb3J0KFs5LCA1LCAxMCwgMywgMl0pIC8vIFsyLCAzLCA1LCA5LCAxMF0="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
function bubbleSort(array) {
  for (let i = 0; i < array.length; i++) {
    if (array[i] > array[i + 1]) {
      [array[i], array[i + 1]] = [array[i + 1], array[i]]
    }
  }
  return array
}

bubbleSort([9, 5, 10, 3, 2]) // [2, 3, 5, 9, 10]
node v10.16.0