Pen Settings



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


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


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.


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.


        <title>JS leading debounce</title>
        <link href="[email protected]&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="./assets/css/main.css">
            <div class="card blue">
                <h1>JS leading debounce</h1>
                <input type="text" onkeyup="processChanges()" />
                <button onclick="processChanges()">Click me</button>


                /* layout relevant styles */
html, body
    width: 100%
    height: 100%
    margin: 0
    display: grid
    height: 100%
    grid-template-columns: auto 33% auto
    grid-template-rows: auto auto auto
    display: grid
    grid-template-columns: 100%
    grid-column: 2
    grid-row: 2

/* other styles */
    padding: 50px
    color: #fff
    border-radius: 20px
    box-sizing: border-box
    font-family: Roboto, sans-serif
    background: rgb(0,174,239)
    background: linear-gradient(135deg, rgba(0,174,239,1) 20%, rgba(45,56,138,1) 100%)

        margin: 0 
        font-size: 3rem
        font-weight: lighter
        text-align: center
        width: auto
        height: 50px
        border-radius: 25px
        border: 0
        line-height: 50px
        padding: 0 20px
        font-size: 1.5rem
        font-family: Roboto, sans-serif
        outline: none

        width: 240px
        height: 50px
        border-radius: 25px
        border: 2px solid #fff
        line-height: 50px
        text-align: center
        font-size: 1.5rem
        color: #fff
        text-decoration: none
        margin-top: 10px
        position: relative
        box-sizing: border-box
        justify-self: center
        background: transparent
        cursor: pointer
        font-family: Roboto, sans-serif
        outline: none

            background: #ffffff
            color: #000
                right: 10px

            content: ">"
            font-family: "Jua"
            position: absolute
            right: 15px
            transition: right 1s ease

a, a:hover
    transition: all 0.3s ease


                function debounce_leading(func, timeout = 300){
  let timer;
  return (...args) => {
    if (!timer) {
      func.apply(this, args);
    timer = setTimeout(() => {
      timer = undefined;
    }, timeout);
function saveInput(){
  console.log('Saving data');

const processChanges = debounce_leading(() => saveInput());