propmt是一個輸入陳述句它的回傳結果是你輸入的內容,無論輸入什么內容回傳結果的資料型別都是字串型別,
alert是一個彈框輸出
console是控制臺輸出
下面代碼的意思是輸入一些內容然后保存到content變數里面
然后alert輸出content變數也就是你從prompt輸入的內容
console控制臺輸出content內容
1 <script> 2 let content = prompt("請輸入內容:"); 3 alert(content); 4 console.log(content); 5 </script>
prompt的顯示樣子,我輸入了3個1,然后保存到了content的變數里面,

下面是alert的顯示結果,我把content變數放到alert里面輸出,

下面是console的顯示結果,同樣是輸出content變數

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/516416.html
標籤:JavaScript
