Languages
[Edit]
EN

JavaScript - prompt function

0 points
Created by:
Inayah-Alexander
437

This article will show you how to use the prompt functions in JavaScript.

The prompt() method displays a  built-in dialog box that prompts you to enter data.

JavaScript - prompt function
built-in prompt dialog box with - JavaScript

Syntax

result = prompt(title, [defaultValue]);

 

Practical example

// ONLINE-RUNNER:browser;

const name = prompt("What's your name", 'Jacob');
console.log('Your name is ' + name);

JavaScript tutorial

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join