JSFiddle - React, Tailwind, and code Playground

by mrjordy

HTML

Please enter your phone number <br />
<input id="thingin" type="range" min="0" max="9999999999"/>
<div id="thingout"/>

CSS

#thingin {
    width: 30px;
}

JavaScript

let thingin = document.getElementById('thingin');

thingin.onchange = function (event) {
	let display = document.getElementById('thingout');
  let n = (10000000000 + thingin.value).toString().slice(1);

	let c = n.slice(-4);
  let b = n.slice(-7,-4);
  let a = n.slice(-10,-7);
  
  display.textContent = a + '-' + b + '-' + c;
};