How to handle a JavaScript pop up with JS-TestCafe?

How can I handle a JavaScript pop up with JS-TestCafe?

Hello Macy,

The below commands can be used to handle a JavaScript pop up with JS-TestCafe:

Alert alert = driver.switchTo().alert();
alert.accept();
alert.dismiss();
alert.getText();
alert.sendkeys(String stringToSend);

Here is the reference: https://www.softwaretestingmaterial.com/javascript-alerts-popups-selenium/