Tell us what’s happening:
Probably i am not understanding the exact requirement. but below code does not seem to satisfy the “0” prefix criteria.
Your code so far
https://Nisha-JavaScript-Calculator.nbhawnani.repl.co
InputCalc(){
this.setState({strDisplay:this.state.strDisplay.replace(/^0{2,}/, “”)+event.target.innerHTML.replace(/^0{2,}/, “”)})
document.getElementById(‘display’).innerHTML=this.state.strDisplay
}
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
Challenge: Build a JavaScript Calculator
Link to the challenge: