+ 1
Don't know why it's not working! Plz help!
function ask(question,yes,no) { if(confirm(question)) { yes(); } else { no(); } } ask("Do you agree?", function() { alert("You agreed."); }, function() { alert("You cancelled the excution."); } ); //I want to write this code using arrow function n ternary operator let ask()=>(question,yes,no)=>confirm(question) ? yes(): no() ask("Do you agree", ()=>alert("you agreed"), ()=>alert("you cancelled the excecution") )
3 Respuestas
+ 3
You wrote ask=>() =>
Instead, do ask=() =>
https://code.sololearn.com/WsWEEevgH9Pb/?ref=app
0
Thanks