+ 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") )

18th Jul 2020, 12:02 PM
Sevda Krithika Sharma
Sevda Krithika Sharma - avatar
2 Answers
+ 3
You wrote ask=>() => Instead, do ask=() => https://code.sololearn.com/WsWEEevgH9Pb/?ref=app
18th Jul 2020, 12:07 PM
Arnesh
Arnesh - avatar
0
Thanks
18th Jul 2020, 2:24 PM
Sevda Krithika Sharma
Sevda Krithika Sharma - avatar