Skip to content

Repl.ask() method

Home > streplts > Repl > ask

Asks a yes/no question and waits for a valid response, resolving with the answer.

Signature:

ask(prompt: string): Promise<string>;

Parameter

Type

Description

prompt

string

The question to present to the user, describing the decision at hand.

Returns:

Promise<string>

A promise that resolves to “y” or “n” based on the user’s input.