Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

HTML

              
                <!DOCTYPE html>
<html lang="en">
<head>

  <meta charset="UTF-8" />
  <title>My New Pen!</title>
  
  
</head>
<body>
  <header>
  <h1>Objectify</h1> 
  </header>
  <form class="form">
  <div class="inputs">
  <input class="input" placeholder="Enter an Array" autofocus> 
  <button onclick="sort()">SORT ARRAY</button>
  </div>
  </form>
  
  <div class="result">
  <pre>
    <div id="rawResult">
    </div>
    </pre>
  </div>
  
  <footer>
    <div class="footer">
      Made With Love By Pelumi
    </div>
  </footer>
</body>
</html>
              
            
!

CSS

              
                *{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: #f5f5f5;
  width: 65%;
  padding: 5rem 1rem;
  margin: 0 auto
}
h1 { color: black;
  font-family: 'Lato', sans-serif;
  font-size: 54px; 
  font-weight: 300; 
  line-height: 58px; 
  margin: 0 0 58px; 
  text-transform: uppercase; 
  text-align: center
}
.form{
  margin: 0 auto;
  
}
.inputs{
  display: block;
  padding: 10px;
}

.input{
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .1rem;
    text-indent: 10px;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    
}
input[type="text"] {
  font-family: monospace;
  font-size: 20px;
  color: peru;
}
button{
  width: 100%;
  height: 50px;
  margin: 10px 0px 0px 0px;
  color: #fff;
  background-color: #343a40;
  border-color: #343a40;
  font-size: 20px;
  border-radius: .25rem;
}
button:hover{
    color: #fff;
    background-color: #23272b;
    border-color: #1d2124;
}
.result{
  display: flex;
}


pre {outline: 1px solid #ccc;
  padding: 5px; 
  margin: 5px;
  width: 100%;
}
.footer{
   position:fixed;
   left:0px;
   bottom:0px;
   height:30px;
   width:100%;
   background:#343a40;
   text-align: center;
   padding: 10px;
   color: #fff;
}
              
            
!

JS

              
                function sort() {
  const numbers = [];
  const strings = [];
  const booleans = [];
  const others = [];
  const value = document.querySelectorAll(".input")[0].value;
  let inputArray

  try {
    inputArray = JSON.parse(value)
  } catch (error){
    alert("Please enter a valid JSON string")
    return;
  }

  const objectResult = {
    "string": strings,
    "number": numbers,
    "boolean": booleans,
  };

  inputArray.forEach(item => {
    objectResult[typeof item].push(item)
  });

  const JsonObj = JSON.stringify(objectResult, undefined, 4)
  document.querySelector("#rawResult").innerText = JsonObj;
}

              
            
!
999px

Console