JSFiddle - React, Tailwind, and code Playground

by Julien MBA-NDONG

HTML

<div id="doStuff"> 
</div>

JavaScript

/**************  v5  *************/
var i = 0, xFriction = 0.01, idInterval = 0, xVelocity = 7;

// an alternative code to call de inc function
function inc(){ 
    
    requestAnimationFrame(inc);
    
    if(!window.requestAnimationFrame) {
        console.log("not requestAnimationFrame");
    }
    
    else if(window.requestAnimationFrame) {
    // Your inc code here
    i += 1; 
    document.getElementById("doStuff").innerHTML = i ;
    console.log("yes requestAnimationFrame");
    }
}

inc();