javascript get srollwidth

JavaScript
        
            
        
     const box = document.querySelector('.box');
const scrollbarWidth = box.offsetWidth - box .clientWidth;
Source

Also in JavaScript: