JavaScript學習筆記(十) ─ 互動alert、prompt、confirm

顯示訊息

alert("Hello");     //顯示hello字串

顯示訊息,要求使用者輸入內容

// result = prompt(title[, default]);let age = prompt('How old are you?', 100);

alert(`You are ${age} years old!`); // You are 100 years old!

顯示對話框,等待使用者確認或取消

// result = confirm(question);let isBoss = confirm("Are you the boss?");

alert( isBoss ); // true if OK is pressed

Written by

Machine Learning / Deep Learning / Python / Flutter cakeresume.com/yanwei-liu

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store