Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript prompt

// window.prompt() => Prompt for user input and return the value:
const person = prompt("Please enter your name");

console.log( "Hello " + person + " !" );

// The 2nd argument (optional) holds the default value:
const color = prompt("Enter a color name", "red");
Comment

javascript input prompt example

const firstName = prompt("Siapa nama depanmu?");
const lastName = prompt("Siapa nama belakangmu?");
const language = prompt("Bisa berbahasa apa?");
 
const user = {
   name: {
       first: firstName,
       last: lastName,
   },
   language: language
};
 
if (user.language === "English") {
   alert("Nice to meet you " + user.name.first + " " + user.name.last + "!");
} else if (user.language === "French") {
   alert("Ravi de vous rencontrer " + user.name.first + " " + user.name.last + "!");
} else if (user.language === "Japanese") {
   alert("Hajimemashite, " + user.name.first + " " + user.name.last + "!");
} else {
   alert("Senang bertemu dengan Anda " + user.name.first + " " + user.name.last + "!");
}
Comment

prompt in javascript

let text = prompt("What's your name?");
if (text !== "") {
  alert(`Your name is: ${text}`);
} else {
  alert(`Name cannot be empty`)
}
Comment

javascript prompts user to input

prompt("your name please")
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript selection in iframe 
Javascript :: convert string number with commas decimal to number javascript 
Javascript :: javascript get month string 
Javascript :: simple javascript code 
Javascript :: javascript onload complete 
Javascript :: discord.js get first mention 
Javascript :: how to convert node list to array in javascript 
Javascript :: how to scroll smoothly in to the top in react js 
Javascript :: toggle checkbox jquery 
Javascript :: discord.js clean content 
Javascript :: js pass object property as a function parameter 
Javascript :: JSON.parse() error handling 
Javascript :: filter nested object array and return whole object 
Javascript :: nextjs layout 
Javascript :: jquery append table row 
Javascript :: reduce array to object javascript 
Javascript :: check local storage javascript 
Javascript :: find and replace value in array of objects javascript 
Javascript :: react native cross out letter 
Javascript :: reactjs cdn 
Javascript :: javascript break out of loop 
Javascript :: stop interval js 
Javascript :: store data to the browser’s localStorage 
Javascript :: formula for scrollbar size 
Javascript :: jquery remove focus from all elements 
Javascript :: print json shopify 
Javascript :: what indexof in javascript 
Javascript :: smooth scroll safari 
Javascript :: jquery check if input is empty 
Javascript :: axios.post headers example 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =