Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <meta charset="utf-8">
  <title>Mocha Tests</title>
  <link href="" rel="stylesheet" />
  <div id="mocha"></div>

  <script src=""></script>
  <script src=""></script>






function getPosition(num, place){
 return  Math.floor(Math.abs(num)/Math.pow(10,place))% 10
}   // gives back bucket index  

function getMax(arr){
  let max=0;
  for(let num of arr){
    if(max < num.toString().length){
      max = num.toString().length
  return max
 function radixSort(arr){
   const max = getMax(arr);
   for(let i=0;i<max;i++){
       let buckets = Array.from({length:10},()=>[]) // creating 10 empty arrays
     for(let j=0;j<arr.length;j++){
         buckets[getPosition(arr[j],i)].push(arr[j]); //push the number into desired
                                                     // bucket
     arr = [].concat(...buckets); 
   return arr


var assert = chai.assert;

  it("should be sorted correctly",()=>{
    const ans = radixSort([4,933,233,3222,1,7,5])
    assert.deepEqual(ans,[1, 4, 5, 7, 233, 933, 3222]);