<h4>Enter Your marks out of 600</h4>
<input type="number" max="600" min="0" onInput="caliculatePercent(this.value)">
<p></p>
// Scales with continuous input and continuous output
const heighestMarks = 600
let scale = d3.scaleLinear()
// Provide the range of values
.domain([0,heighestMarks])
// Provide range of output need
.range([0,100])
function caliculatePercent(value){
d3.select("p")
.text(`Your Percentage is ${scale(value)}%`)
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.