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

              
                <div id="result">
  Dictionary search starts ... <span class="object">🚀</span>
</div>
              
            
!

CSS

              
                * {
  font-size: 24px;
}

              
            
!

JS

              
                // Populate Array size of 10 Million data 😱
let data = [];
const tenMillion = 10_000_000;
console.log("starts");
console.time("prepare array");
for (let i = 0; i < tenMillion; i++) {
  data.push({ item: i, number: `Number_${i}` });
}
console.timeEnd("prepare array");

// Populate Array size of 50 having random numbers.
// We will search each item of this array in that big size of array 🤒
const itemsToSearch = Array.from(
  { length: 50 },
  () => ~~(Math.random() * 9_000_000)
);

console.time("transform_array_to_dictionary");
console.time("time_including_tranforming_array_to_dict");
let dataDict = {};
data.forEach((d) => (dataDict[d.item] = d));
console.timeEnd("transform_array_to_dictionary");

console.log("Dictionary search starts");
const startTime = new Date().getTime();
const timeLogs = itemsToSearch.map((searchItem) => {
  const start = new Date().getTime();
  const item = dataDict[searchItem];
  const end = new Date().getTime();
  return `Took ${end - start} Milliseconds to find ${searchItem}`;
});
const endTime = new Date().getTime();
// console.log(timeLogs);
console.timeEnd("time_including_tranforming_array_to_dict");

const resultElement = document.getElementById("result");
resultElement.innerText = `Searching the array took ${
  endTime - startTime
} milliseconds for ${
  itemsToSearch.length
} items over 10 Million size of Array.`;

console.log(
  `Searching the array took ${endTime - startTime} milliseconds for ${
    itemsToSearch.length
  } items over 10 Million size of Array.`
);

              
            
!
999px

Console